I currently create a AppIntent that contains a custom AppEntity, it shows like this
struct GetTimerIntent: AppIntent {
static let title: LocalizedStringResource = "Get Timer"
@Parameter(title: "Timer")
var timer: TimerEntity
func perform() async throws -> some IntentResult {
.result(value: timerText(timer.entity))
}
static var parameterSummary: some ParameterSummary {
Summary("Get time of \(\.$timer)")
}
func timerText(_ timer: ETimer) -> String {
// Implementation Folded
}
}
struct TimerEntity: AppEntity {
var entity: ETimer
static let defaultQuery: TimerQuery = .init()
static var typeDisplayRepresentation: TypeDisplayRepresentation {
TypeDisplayRepresentation(name: "Timer")
}
var id: UUID {
entity.identifier
}
var displayRepresentation: DisplayRepresentation {
DisplayRepresentation(title: "\(entity.title)")
}
}
To get the timers, I create a TimerQuery type to fetch them from SwiftData containers.
struct TimerQuery: EntityQuery, Sendable {
func entities(for identifiers: [UUID]) async throws -> [TimerEntity] {
print(identifiers)
let context = ModelContext(ModelMigration.sharedContainer)
let descriptor = FetchDescriptor<ETimer>(
predicate: #Predicate {
identifiers.contains($0.identifier)
},
sortBy: [.init(\.index)]
)
let timers = try context.fetch(descriptor)
print(timers.map(\.title))
return timers.map {
TimerEntity(entity: $0)
}
}
}
Everything looks make sense since I code it. When I'm testing, the console jump
No ConnectionContext found for 105553169752832 and I can't get my datas.
How can I solve this issue?
General
RSS for tagDelve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hey,
I would love to access the users Contact (ie. the Me Card)
Apple recently released the Invites app and within this app you can find the users Contacts Photo. I tried to replicate this behaviour but I currently need to match based on a name or email or something else. I have no idea how to receive this data because when using the Invites app I only remember the app asking for Contacts permission and nothing else so far.
let store = CNContactStore()
let keysToFetch = [CNContactImageDataAvailableKey, CNContactImageDataKey, CNContactThumbnailImageDataKey] as [CNKeyDescriptor]
let email = "test@test.de"
let predicate = CNContact.predicateForContacts(matchingEmailAddress: email)
do {
let contacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch)
let imageDatas: [Data] = contacts.compactMap { $0.imageData }
self.images = imageDatas.map { UIImage(data: $0) ?? UIImage() }
} catch {
print("Error fetching contacts: \(error)")
}
This is how I am retrieving the Image. MAYBE someone can help me out.
Thank you so far
~ Flo
I'm trying to add Siri support to my app for sending voice messages. I've implemented INSendMessageIntentHandling in my main app target.
It looks like it's getting as far as recording the voice message and passing my intent handler an INSendMessageIntent with an audio attachment, but I'm not able to read the attachment file.
func handle(
intent: INSendMessageIntent,
completion: @escaping (INSendMessageIntentResponse) -> Void
) {
if let attachment = intent.attachments?.first,
let audioFile = attachment.audioMessageFile,
let fileURL = audioFile.fileURL
{
// This branch runs
// fileURL is "file:///var/mobile/tmp/SiriMessages/89F738F7-6092-439A-B4FA-2DD9A99F0EED.caf"
let result = processMessageAudio(url: fileURL)
completion(result)
return
}
// This line isn't reached
completion(.init(code: .failure, userActivity: nil))
}
private func processMessageAudio(url: URL) -> INSendMessageIntentResponse {
var fileRef: ExtAudioFileRef?
if url.startAccessingSecurityScopedResource() {
logDebug("File access allowed")
} else {
// This branch runs
logDebug("File access not allowed")
}
defer {
url.stopAccessingSecurityScopedResource()
}
let openStatus = ExtAudioFileOpenURL(url as CFURL, &fileRef)
// openStatus is -54 (kAudio_FilePermissionError)
return INSendMessageIntentResponse(code: .failure, userActivity: nil)
}
I'm not sure what I'm missing. It looks like there should be an audio file, and Siri shows a preview of the audio for confirmation.
Issue:
Using Messages in macOS Sequoia, I stop receiving any messages after 7+ hrs of the system being on.
Troubleshooting:
any messages sent to the target account doesn't show up when this issue occurs.
I'm able to send messages from the target account which is received.
only way to get it working is to reboot the computer but those messages sent never arrive to the target account even after reboot.
upon reboot the behavior functions as expected.
however the issue returns after 7hrs+ after reboot.
logout and log back in when the system is in this state doesn't resolve the issue. only a reboot but the issues eventually returns.
note the 7hrs+ is tested and is more accurately 7-10 hrs.
Hello everyone,
I hope you’ll all bear with me as I get up to speed. My background is in Unix, procedural languages, mission critical databases and enterprise applications.
I’ve just started heading a team with an iOS app used in healthcare that contains confidential patient information (PHI) that's governed by HIPAA and FDA cybersecurity, etc.
It seems there’s some contention in the team over whether the app, SQLite db, and medical images belong in the Documents or an Application Support directory in the Library.
From everything I’ve read, it seems that Apple’s intent is Library/Application Support.
Two questions:
Which is the correct location? And hopefully, a few compelling justifications.
On one of our iPads, the app stopped displaying what was two years of data in SQLite. I haven’t yet tested for index corruption, however one of the programmers believes this resulted from an iOS update that needed space and cleared data in the cache (but that makes no sense to myself).
Feedback highly appreciated. Many thanks,
David
Why, because somebody has to
I have my application named "TestDataPro" in apple store.
When I open the application and click on apple icon, my application crash.
It is working fine in MACOS version 14.2.1.
But it is causing crash in MACOS version 14.5 and 14.6 with having Apple M1 or M2 chip.
While for the same MACOS version with having intel chip it is working fine.
I have attached crash log. Can you please help me to find the root cause for this?
TDPCrashReport.txt
Topic:
App & System Services
SubTopic:
General
I recently used Open core legacy patcher to update my old 2012 Macbook pro to run a new pice of dj software. the update went smooth but now the Dj software wont open just gives me a crash report. Im totally stumped.
the crash report.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process: exc handler [3839]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 Engine DJ 0x10c9e3d81 0x10c28f000 + 7687553
1 dyld 0x7ff807632729 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 241
2 dyld 0x7ff80766b34e invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 133
3 dyld 0x7ff80765fb73 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 543
4 dyld 0x7ff80761a07b dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 249
5 dyld 0x7ff80765ebe8 dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 176
6 dyld 0x7ff807661266 dyld3::MachOFile::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, bool&) block_pointer) const + 116
7 dyld 0x7ff80766b084 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 390
8 dyld 0x7ff8076325c2 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 150
9 dyld 0x7ff807638af7 dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 21
10 dyld 0x7ff807632928 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 276
11 dyld 0x7ff807636141 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const + 147
12 dyld 0x7ff8076329bc dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 90
13 dyld 0x7ff80764e1f7 dyld4::APIs::runAllInitializersForMain() + 277
14 dyld 0x7ff80761f52e dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3433
15 dyld 0x7ff80761e792 dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const + 572
16 dyld 0x7ff80761e27f start + 1727
Thread 1:
0 libsystem_pthread.dylib 0x7ff8079a8bcc start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x7ff8079a8bcc start_wqthread + 0
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00006000012acc80 rbx: 0x00006000032b3c90 rcx: 0x00006000012acd00 rdx: 0x000000011008e000
rdi: 0x0000000000000000 rsi: 0x00006000012ac000 rbp: 0x00007ff7b3c5a9f0 rsp: 0x00007ff7b3c5a9c0
r8: 0x0000000000000002 r9: 0x000000000000001b r10: 0x00000000001ff800 r11: 0x0000000000000080
r12: 0x000000010eeae278 r13: 0x000000010c28f6e8 r14: 0x00007ff84a461050 r15: 0x00007ff84a4614a0
rip: 0x000000010c9e3d81 rfl: 0x0000000000010207 cr2: 0x0000000000000000
Logical CPU: 2
Error Code: 0x00000000
Trap Number: 6
Topic:
App & System Services
SubTopic:
General
I have developed a standalone WatchOS app which runs a stopwatch.
I want to develop a shortcut that launches the stopwatch. So far I have created the Intent file, and added the basic code (shown below) but the intent doesn't show in the shortcuts app.
In the build, I can see the intent metadata is extracted, so it can see it, but for some reason it doesn't show in the watch.
I downloaded Apple's demo Intent app and the intents show in the watch there. The only obvious difference is that the Apple app is developed as an iOS app with a WatchOS companion, whereas mine is standalone.
Can anyone point me to where I should look for an indicator of the problem?
Many thanks!
//
// StartStopwatch.swift
// LapStopWatchMaster
import AppIntents
import Foundation
struct StartStopWatchAppIntent: AppIntent {
static let title: LocalizedStringResource = "Start Stopwatch"
static let description = IntentDescription("Starts the stopwatch and subsequently triggers a lap.")
static let openAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult {
// Implement your app logic here
return .result(value: "Started stopwatch.")
}
}
I am creating an iOS app that needs to parse the text from a PDF document. I can read the entire PDF document's text using the string property, but if it's a large PDF document, this could cause delays for users.
From the documentation, I came across the beginFindString function, which seems to asynchronously, with no return?
https://developer.apple.com/documentation/pdfkit/pdfdocument/beginfindstring(_:withoptions:))
Unfortunately I cannot find examples on how to use this function or its intended purpose/functionality, so any guidance would be appreciated.
My goal is to read the PDF document one line at a time, searching for newlines ('\n'), then parsing that line as needed. I'm hoping the beginFindString function will be useful.
Is there a way to distinguish physical mouse/keyboard input from remote control mouse/keyboard input on Mac? Or even better, is there a way to detect if my Mac is being remotely controlled?
hi
where do we need to upload documents and video for the sharing URL for the apple to review while submitting the APP .
Topic:
App & System Services
SubTopic:
General
I just noticed something really odd with WeatherKit.
If the temperate at midnight of the FOLLOWING day is colder than all temps in the day you want weather for then WeatherKit will report that as the low temperature for the day even though it's a different day.
Here it's reporting the lowest temp for Feb 6 is 22F. But that's a temp from Feb 7. I'm displaying lowTemperature and lowTemperatureTime from DayWeather as well as the HourWeather in these examples.
I wasn't sure if this was working as designed or a bug. I can provide raw data from this example.
----daily formatted start
weather for Feb 6
High 41°
high at Feb 6 at 2 PM
Low 22°
low at Feb 7 at 12 AM
----daily formatted end
Feb 6 at 12 AM 34°
Feb 6 at 1 AM 35°
Feb 6 at 2 AM 36°
Feb 6 at 3 AM 36°
Feb 6 at 4 AM 36°
Feb 6 at 5 AM 34°
Feb 6 at 6 AM 33°
Feb 6 at 7 AM 33°
Feb 6 at 8 AM 33°
Feb 6 at 9 AM 33°
Feb 6 at 10 AM 35°
Feb 6 at 11 AM 36°
Feb 6 at 12 PM 38°
Feb 6 at 1 PM 40°
Feb 6 at 2 PM 41°
Feb 6 at 3 PM 40°
Feb 6 at 4 PM 39°
Feb 6 at 5 PM 37°
Feb 6 at 6 PM 36°
Feb 6 at 7 PM 33°
Feb 6 at 8 PM 31°
Feb 6 at 9 PM 29°
Feb 6 at 10 PM 27°
Feb 6 at 11 PM 24°
Feb 7 at 12 AM 22°
在执行完 INIntent 或者AppIntent的Shortcuts后,刷新 WidgetKit桌面小组件
We're running into an issue with our pkg bundle where the main .app file disappears after installation and wanted to see if anyone has an idea about what would cause it.
We have a pkg bundle with three separate apps, one primary app and two supporting apps. We distribute this pkg bundle directly to our users, who will manually install it on their devices (rather than through the app store).
The installation itself will usually complete without any issues, and we aren't seeing anything in the install or system logs indicating that it was removed afterward (our postinstall script checks that all of the files exist and are in the correct locations), but after the installation the main app disappears while the rest of the files (including the supporting apps) we lay down are still present. Sometimes it will fail with an error similar to this:
2024-10-02 09:43:07-04 MBA-L-8114 installer[9894]: Error getting application status info for file:///Applications/.hiddenfolder/app1.app: Error Domain=NSCocoaErrorDomain Code=260 "The file "app1.app" couldn't be opened because there is no such file." UserInfo={NSURL=file:///Applications/.hiddenfolder/app1.app, NSFilePath=/Applications/.hiddenfolder/app1.app, NSUnderlyingError=0x6000026a0d50 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
This only happens on certain computers, but on those computers it will happen consistently. We have noticed that it seems to happen more often with computers that are MDM configured.
So far we’ve investigated permissions issues with the build process, installation script issues, and signing/notarizing, but have not found anything that might cause this issue. We did verify that we’re setting BundleIsRelocatable NO in the plist file for our package, so in theory it shouldn’t be trying to move the app after installation (we don't see the main app anywhere on the device so macOS doesn't seem to be moving it).
We have another post going into more technical detail here: https://developer.apple.com/forums/thread/769443
Topic:
App & System Services
SubTopic:
General
Hello!
It's my first time posting in this forum. Apple Intelligence is enabled by default in Workspace ONE (WS1). I was wondering if Apple Intelligence can access or process corporate data within (WS1) corporate apps, which are containerized?
Thank you!
Topic:
App & System Services
SubTopic:
General
I've noticed that very consistently the Weatherkit API times out when I make a large(-ish) number of calls at 7am east coast time.
If I make x calls between 7:00:00 and 7:01:00 about half of them time out (as do retries.)
If I make 2x the calls between 7:15:00 and 7:16:00 there are close to zero time outs.
I've looked at the logs, at the calls per second, etc., and there is no difference between 7 and 7:15.
So, I'm not hitting a rate limit. It seems like Weatherkit itself just can't handle the traffic at peak times.
Is there any other explanation? Does Apple intend to make sure the API can handle all the traffic they are getting paid to handle?
Hello, I am currently optimizing the performance of my application. I would like to obtain information about users being killed after leaving the application in the background, in order to evaluate whether the application is running normally in the background. I noticed that there is a Background Termination information in Xcode ->Organizer that records background exits. I would like to know the rules for obtaining this information and what is the health standard for this indicator on the Apple side?
Speech Framework
I've been checking for SFSpeechRecognitionMetadata to determine the end of a sentence when using Voice Recognition.
Yet it doesn't detect small pauses but only large ones, so that I've transcribed basically an entire paragraph before going onto the next one.
Besides implementing your own timer, are there any other ways to have more natural pauses to detect the end of sentences, similar to the browser's Web Speech recognition? Since it's in Safari, I assume there should be some similar feature that can be equivalent in MacOS.
Hey,
I'm trying to update my old app that used DarkSky to WeatherKit, and struggling. I always get:
ailed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
This is regardless if I do it on my iPad, or in the simulator. I have done the following:
Selected WeatherKit on the Capabilities and App Services tabs of the Identifier section on developer.
Put it under signing and capabilities in XCode
I've tried making a new provisioning profile, cleaning build folder, etc. Not sure what to do here. I suspect part of this problem is that I developed this app in 2018 and now I'm trying to update it.
I am able to run the app on TestFlight, but not as an internal tester. Apple won't let me, so I have to add myself as an external tester.
Thanks for any help you can provide!
I have a question regarding a feature in the app where it calls another app.
We have a feature in our app where a WKWebView opens another app via a custom URL scheme. Initially, the system displays an alert saying, "Do you want to open Target App from My App?". However, once the user allows this action, the alert is no longer shown, and the Target App opens directly on subsequent attempts.
The issue is that if the user no longer wants the app to redirect to the Target App, they cannot reset this preference or re-enable the alert.
Is there a way, from the user's perspective, to make the alert reappear when trying to open the Target App again?
Topic:
App & System Services
SubTopic:
General