Delve 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.

Post

Replies

Boosts

Views

Activity

WeatherKit historical
is using /api/v1/weather/{language}/{latitude}/{longitude} the correct way to retrieve historical weather data for a location? e.g. getting hourly weather data for Seattle from 2016-03-04 to 2016-03-11? https://developer.apple.com/documentation/weatherkitrestapi/get-api-v1-weather-_language_-_latitude_-_longitude_ this is pointed out in the API docs as being the method to pull hourly weather data for a specific location. It doesn't indicate wether it is for current weather or historical
1
0
134
4d
LiveCommunicationKit: report Incoming but Assertion failure in -[PKPushRegistry _terminateAppIfThereAreUnhandledVoIPPushes]
I completed the CallKit Demo with the same code. When I changed to LiveCommunicationKit, the code goes perfectly when the app is in foreground, but it crashed in background. If I changed the reportIncoming method from LCK to CallKit, it goes well. What is the reason? I changed the method from func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) to func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) async it crashed before show the print "receive voip noti". Here is the core code: var providerDelegate: ProviderDelegate? func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) { if type != .voIP { return } guard let uuidString = payload.dictionaryPayload["uuid"] as? String, let uuid = UUID(uuidString: uuidString), let handle = payload.dictionaryPayload["handle"] as? String, let hasVideo = payload.dictionaryPayload["hasVideo"] as? Bool, let callerID = payload.dictionaryPayload["callerID"] as? String else { return } print("receive voip noti: \(type):\(payload.dictionaryPayload)") if #available(iOS 17.4, *) { // This code is only goes perfectly when the App is in foreground var update = Conversation.Update(members: [Handle(type: .generic, value: callerID, displayName: callerID)]) if hasVideo { update.capabilities = [.video, .playingTones] } else { update.capabilities = .playingTones } Task { @MainActor in do { print("LCKit report start") try await LCKitManager.shared.reportNewIncomingConversation(uuid: uuid, update: update) print("LCKit report success") completion() } catch { print("LCKit report failed") print(error) completion() } } } else { // It went perfectly providerDelegate?.reportIncomingCall(uuid: uuid, callerID: callerID, handle: handle, hasVideo: hasVideo) { _ in completion() } } @available(iOS 17.4, *) final class LCKitManager { static let shared = LCKitManager() let manager: ConversationManager init() { manager = ConversationManager(configuration: type(of: self).configuration) manager.delegate = self } static var configuration: ConversationManager.Configuration { ConversationManager.Configuration(ringtoneName: "Ringtone.aif", iconTemplateImageData: #imageLiteral(resourceName: "IconMask").pngData(), maximumConversationGroups: 1, maximumConversationsPerConversationGroup: 1, includesConversationInRecents: true, supportsVideo: false, supportedHandleTypes: [.generic]) } func reportNewIncomingConversation(uuid: UUID, update: Conversation.Update) async throws { try await manager.reportNewIncomingConversation(uuid: uuid, update: update) } } final class ProviderDelegate: NSObject, ObservableObject { static let providerConfiguration: CXProviderConfiguration = { let providerConfiguration: CXProviderConfiguration if #available(iOS 14.0, *) { providerConfiguration = CXProviderConfiguration() } else { providerConfiguration = CXProviderConfiguration(localizedName: "Name") } providerConfiguration.supportsVideo = false providerConfiguration.maximumCallGroups = 1 providerConfiguration.maximumCallsPerCallGroup = 1 let iconMaskImage = #imageLiteral(resourceName: "IconMask") providerConfiguration.iconTemplateImageData = iconMaskImage.pngData() providerConfiguration.ringtoneSound = "Ringtone.aif" providerConfiguration.includesCallsInRecents = true providerConfiguration.supportedHandleTypes = [.generic] return providerConfiguration }() private let provider: CXProvider init( { provider = CXProvider(configuration: type(of: self).providerConfiguration) super.init() provider.setDelegate(self, queue: nil) } func reportCall(uuid: UUID, callerID: String, handle: String, hasVideo: Bool, completion: ((Error?) -> Void)? = nil) { let callerUUID = UUID() let update = CXCallUpdate() update.remoteHandle = CXHandle(type: .generic, value: callerID) update.hasVideo = hasVideo update.localizedCallerName = callerID // Report the incoming call to the system provider.reportNewIncomingCall(with: callerUUID, update: update) { [weak self] error in completion?(error) } } }
18
0
656
2w
AASA - 403 Forbidden
Hello, we encountered a 403 error while accessing AASA. > curl -i 'https://app-site-association.cdn-apple.com/a/v1/finture.id' HTTP/1.1 404 Not Found Content-Type: text/plain; charset=utf-8 Content-Length: 10 Connection: keep-alive Server: nginx Date: Fri, 28 Feb 2025 03:17:02 GMT Expires: Fri, 28 Feb 2025 03:17:12 GMT Age: 1122 Apple-Failure-Details: {"status":"403 Forbidden"} Apple-Failure-Reason: SWCERR00101 Bad HTTP Response: 403 Forbidden Apple-From: https://finture.id/.well-known/apple-app-site-association Apple-Try-Direct: false Via: https/1.1 jptyo12-3p-pst-007.ts.apple.com (acdn/14454.1), http/1.1 jptyo12-3p-pac-027.ts.apple.com (acdn/14454.1), https/1.1 jptyo12-3p-pfe-014.ts.apple.com (acdn/14454.1) X-Cache: MISS KS-CLOUD CDNUUID: 51e5b30b-1f3c-4778-bb6f-cff5447ad763-1988011596 x-link-via: ntct03:443;xianymp018:443;gzct61:443;xg36:443; x-b2f-cs-cache: no-cache X-Cache-Status: MISS from KS-CLOUD-XG-FOREIGN-36-07 X-Cache-Status: MISS from KS-CLOUD-GZ-CT-61-05 X-Cache-Status: MISS from KS-CLOUD-XIANY-MP-018-25 X-Cache-Status: MISS from KS-CLOUD-NT-CT-03-03 X-KSC-Request-ID: f1f2bf47e4b7e7b93596bbe7d60b1583 CDN-Server: KSFTF X-Cdn-Request-ID: f1f2bf47e4b7e7b93596bbe7d60b1583 Not Found But we can access https://finture.id/.well-known/apple-app-site-association. How should we solve this, thank you.
1
0
107
1w
Bundle A Command Line Tool With MacOS Sandbox App
Hello, I'm buiding a macos app where I bundled a command line tool (Python) with my app. I put the tool in ****.app/Contents/MacOS folder, but it seems like the tool can not execute/read/ access. I don't know if a sandbox app can access/create a folder inside ****.app/Contents folder??? If not where can I put the tool that can access from my macos app? Any idea would be appreciated!
2
0
222
1w
How can a live caller id database be scaled to support millions of numbers that constantly change if it must be KPIR encoded?
The example database/server provided by Apple for Live Caller ID contains a hardcoded database with a tiny number of pre-defined numbers. However, its not expected to be representational of an live real world usage server. But the question is how can that be accomplished if its a requirement that the data be KPIR encrypted? In real world scenarios, the factors that effect whether a number should be blocked or not are continually changing and evolving on a minute-by-minute basis and new information becomes available or existing information changes. If the database supports tens of millions or hundreds of millions of constantly changing phone numbers, in order to meet the requirements of the Live Caller ID being KPIR encrypted, that would imply the database has to re-encrypt its database of millions endlessly for all time. That seems unfeasable and impractical to implement. Therefore how do the Apple designers of this feature envisage/suggest a real-world server supporting millions of changing data should meet the requirement to be KPIR encrypted?
0
0
243
1w
Use UnionValue For AppIntent Parameter
I'm currently trying to use the new @UnionValue macro. From what I understood, it allows multiple types for a parameter. I created the following enum: @UnionValue enum IntentDuration { case int(Int) case duration(Measurement<UnitDuration>) } Then, I tried to use it in the following AppIntent: struct MyIntent: AppIntent { static let title: LocalizedStringResource = "intent.title" static let description = IntentDescription("intent.description") static let openAppWhenRun: Bool = true @Parameter var duration: IntentDuration @Dependency private var appManager: AppManager @MainActor func perform() async throws -> some IntentResult { // My action return .result() } } However, I get the following error from Xcode at the @Parameter line: 'init()' is unavailable Did I wrongly understand how this works? Is there another way to accept multiple types for a parameter? I didn't manage to find any docs on this.
0
0
123
5d
Guidance on Upgrading to Production Access for Screen Time API
Hello everyone, I’m currently developing an app that uses the Family Controls API, specifically the Screen Time API. However, my current entitlement is limited to development mode, which prevents me from publishing my app on TestFlight. I have already contacted Apple Developer Support for production access but wanted to reach out to the community as well and I was referenced to FamilyControls API documentation and I couldn't find anything related to my case. Has anyone successfully upgraded their entitlement from development-only to production? Any insights on the process, tips for communicating with Developer Support, or guidance on ensuring full compliance with the Family Controls guidelines would be extremely helpful.
0
0
134
6d
WeatherKit AuthService Error
I have an app that I configured correctly. Checked the WeatherKit for the App ID, and added the WeatherKit to the Entitlements, and verified the Bundle ID was correct. I am getting the following error: Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)" Encountered an error when fetching weather data subset; location=<+38.97170000,-95.23530000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 3/1/25, 8:34:24 AM Central Standard Time, error=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors 2 Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)" I then made a super simple app that has a hard coded CLLocation and makes the single API call to get the weather and that fails with the same error. This error is still happening after 12 - 48 hours after creating the AppID. I have dumped the contents of the Provisioning Profile for both apps and the Entitlement section looks correct for both. I am not sure what is configured incorrectly, or what steps I should take next.
1
0
158
1w
iPadOS Sysdiagnose - invoke via API
Hello, I would like to ask if there is any possibility to invoke the Apple Sysdiagnose via an API call. I cannot find any API reference for Sysdiagnose. I am aware only about the manually invocation. https://it-training.apple.com/tutorials/support/sup075/ However, this is pretty annoying since a reproduction of a hunted bug takes several hours, so I am looking for the way how to invoke Sysdiagnose from our code.
1
0
149
1w
iOS app crash when both .backgroundTask() and .scenePhase in App file
I've been having trouble with .backgroundTask(.appRefresh()) causing an intermittent crash when my app is launched. When the crash happens, the app flashes a darkened screen with the home screen device information (time-of-day, battery life, etc) weirdly pivoted landscape and right-justified. This screen shows for a split-second, disappears, and the app does NOT launch. Re-tapping the app icon will often re-launch the app without incident. After much trouble-shooting, I've discovered that commenting out EITHER @Environment(\.scenePhase) private var phase or the .backgroundTask(.appRefresh()) {} code eliminates the crash, so it's somehow caused by having both present at the same time. As you can see in the example below, it's not even necessary to actually use .scenePhase or .backgroundTask to run any other code in order to create the crash. The following minimal reproducible example will create the crash on an actual device, although you may need to launch and quit the app in quick succession 10-20 times to see the crash. (I realize most users aren't likely to do that - sometimes the crash occurs in the actual app on the first launch. But it's an intermittent problem so may require a few testing rounds to appear.) In addition to the code shown here, I've added the "Background Modes" capability with "Background Fetch" to "Signing & Capabilities" and added the "UpdateBadge" task to "Info" as a "Permitted background task scheduler identifier". Any idea what could be causing the crash and how to prevent it? struct ToyBackgroundTasksApp: App { @Environment(\.scenePhase) private var phase var sharedModelContainer: ModelContainer = { let schema = Schema([ Item.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ContentView() } .modelContainer(sharedModelContainer) .backgroundTask(.appRefresh("UpdateBadge")) { print("background task") } } }
3
0
183
1w
Shortcut Automation Support
I am currently facing an issue when trying to enable Shortcut support and would greatly appreciate your assistance in resolving it. I have successfully enabled Shortcut support, and I can find my app and its respective functionalities within the Shortcuts app. However, I am unable to locate my app when attempting to create an automation within Shortcuts. I would appreciate any guidance or solutions you may offer regarding this matter.
1
0
180
Jan ’25
Live Caller ID Lookup - CipherMLError.missingSecre t Ke y error
I'm trying to implement live caller id PIR server in python and I have an issue related to evaluation key config. I don't receive the POST /key request even if I try to install the extension on new device and I had this error in device system logs: error 11:21:30.663022+0200 ciphermld requestData(byKeywords:shardIds:clientConfig:) threw an error: CipherML.CipherMLError.missingSecre t Ke y I think the reason why the evaluation key is not generated is related to this error but I'm not sure. It might be also related to HE params - I tried with the same params as in swift server example with plaintext_modulus=17 and it works, but for plaintext_modulus=65537 on the same device the system doesn't send me the evaluation key. Is there a limitation that restricts the evaluation key generation for some HE params? There is how the entire config object that I retrieve looks like: { "configs": { "Live-C aller-ID-Lookup. TestLiveCallerI D.iden tity": { "pir_config": { "encry ption_p aram eters": { "pol ynomial_deg ree": "4096", "plaint ext_mo dulus": "65537", "coeff icient_m oduli": [ "134176769", "268369921", "268361729" ], "secu rity_le vel": "SECU RITY LEVEL QUANT UM128", "h e_sc heme": "H E_SC HEM E_B F V" }, "shard_configs": [ { "num_entries": "2", "entry_size": "55991", "dimensions": [ "2", "1" ], "shard_id": "" } ], "keyword_pir_params": { "num_hash_functions": "2", "sharding_function": { "sha256": {} } }, "algorithm": "PIR _ALGO RITHM _MUL_PIR", "batch_size": "2", "evalu ation_ke config_hash": "" }, "config_id": "" } }, "key_info": [ { "timestamp": "1738660849", "key_config": { "encryp tion_par ameters": { "polynomial_degree": "4096", "plaintex t_mo dulus": "65537", "coeffic ient_m oduli": [ "134176769", "268369921", "268361729" ], "secu rity_level": "SECUR ITY_LEVEL_QU ANTUM128", "he_sc heme": "HE_SC HEME_BFV" }, "gal ois_e lements": [ 20 49, 40 97 ], "has _rel in_key": true } } ] } PS evaluation key data is just a placeholder, but anyway it should be skipped cause of expired timestamp More logs: ```language default 11:21:30.535865+0200 ciphermld Running rotation task for ["Live-Caller-ID-Lookup.TestLiveCallerID.identity"] info 11:21:30.535953+0200 ciphermld Skipping groups that manage their own networking: &lt;private&gt; default 11:21:30.537007+0200 ciphermld Request to fetchConfigs has started for useCases '["Li ve-Caller-ID-Lookup.TestLiveCallerID.identity"]', userId: '&lt;private&gt;', existingConfigIds: '["id"]' default 11:21:30.542174+0200 ciphermld Request to queries-batch has started for userId: '&lt;private&gt;', length: 28350 default 11:21:30.655914+0200 ciphermld Request to fetchConfigs has finished, response length: 230 default 11:21:30.656182+0200 ciphermld Received configurations: 1 usecase(s), 1 key(s) for group 'Live-Caller-ID-Lookup.TestLiveCallerID.identity' debug 11:21:30.660868+0200 ciphermld Skipping non-active key: timestamp: 1738660849 key_config { encryption_parameters { polynomial_degree: 4096 plaintext_modulus: 65537 coefficient_moduli: [134176769, 268369921, 268361729] security_level: Quantum128 he_scheme: BFV } galois_elements: [2049, 4097] has_relin_key: true } error 11:21:30.662982+0200 ciphermld No key for use-case 'Live-Caller-ID-Lookup.TestLiveCallerID.identity' error 11:21:30.663022+0200 ciphermld requestData(byKeywords:shardIds:clientConfig:) threw an error: CipherML.CipherMLError.missingSecre t Ke y default 11:21:30.663824+0200 com.apple.CallKit.CallDirectory &lt;private&gt; XPC request complete, results(0) error:Error Domain=CipherML.CipherMLError Code=32 "missing secre t ke y" UserInfo={NSLocalizedDescription=missing secre t ke y} default 11:21:30.972372+0200 ciphermld Request to queries-batch has finished response, length: 0 default 11:21:30.974711+0200 com.apple.CallKit.CallDirectory &lt;private&gt; XPC request complete, results(1) error:(null) default 11:21:36.161964+0200 com.apple.CallKit.CallDirectory &lt;private&gt; Sending XPC request default 11:21:36.163149+0200 com.apple.CallKit.CallDirectory &lt;private&gt; Sending XPC request default 11:21:36.169931+0200 ciphermld requestData(byKeywords:shardIds:clientConfig:) method was called default 11:21:36.170448+0200 ciphermld requestData(byKeywords:shardIds:clientConfig:) method was called default 11:21:36.174001+0200 ciphermld Cached: 0 / Missing: 1 error 11:21:36.174997+0200 ciphermld No userId or secre t Ke y for use-case '.Lve-Caller-ID-Lookup.TestLiveCallerID.identity'. Running rotation task' default 11:21:36.175075+0200 ciphermld Running rotation task for ["Live-Caller-ID-Lookup.TestLiveCallerID.identity"] info 11:21:36.175240+0200 ciphermld Skipping groups that manage their own networking: &lt;private&gt; default 11:21:36.177700+0200 ciphermld Request to fetchConfigs has started for useCases '["Live-Caller-ID-Lookup.TestLiveCallerID.identity"]', userId: '&lt;private&gt;', existingConfigIds: '["id"]' default 11:21:36.179914+0200 ciphermld Request to queries-batch has started for userId: '&lt;private&gt;', length: 28350 default 11:21:36.336051+0200 ciphermld Request to fetchConfigs has finished, response length: 230 default 11:21:36.336308+0200 ciphermld Received configurations: 1 usecase(s), 1 key(s) for group 'Live-Caller-ID-Lookup.TestLiveCallerID.identity' debug 11:21:36.341522+0200 ciphermld Skipping non-active key: timestamp: 1738660849 key_config { encryption_parameters { polynomial_degree: 4096 plaintext_modulus: 65537 coefficient_moduli: [134176769, 268369921, 268361729] security_level: Quantum128 he_scheme: BFV } galois_elements: [2049, 4097] has_relin_key: true } error 11:21:36.356497+0200 ciphermld No key for use-case 'Live-Caller-ID-Lookup.TestLiveCallerID.identity' error 11:21:36.356669+0200 ciphermld requestData(byKeywords:shardIds:clientConfig:) threw an error: CipherML.CipherMLError.missingSecre t Ke y default 11:21:36.357075+0200 com.apple.CallKit.CallDirectory &lt;private&gt; XPC request complete, results(0) error:Error Domain=CipherML.CipherMLError Code=32 "missing secre t ke y" UserInfo={NSLocalizedDescription=missing secre t ke y} default 11:21:36.625701+0200 ciphermld Request to queries-batch has finished response, length: 0 default 11:21:36.626749+0200 com.apple.CallKit.CallDirectory
0
0
107
1w
Unknown app crash issue
Hello. Recently, there have been many app crash issues of unknown causes. It has been reported that the app crashes as soon as it is launched, but it is difficult to resolve the issue because it cannot be reproduced. I have attached the crash log, so please review it and provide appropriate guidance. Thank you. 2025-02-28_06-02-16.3498_+0900-65dfc1f2a58da46e9ec11a5f0f93f5a56c6858de.crash
1
0
181
1w
How to validate a property list has the right structure
I need to read data from the user. For convenience, the data will be in a property list, so it's easy to get a dictionary containing the property list data. But, since it's coming from outside, I need to validate that the data is in the required format, i.e. it has the right keys and the right sort of data for each key, e.g. <name> has a string, <keys> has an array of appropriate values. Since this is part of a long-established product, and targets 10.13, I want to do this in Objective-C if possible. I've been working mostly with Swift in recent years, so I've forgotten a lot of what I used to know about Objective-C, I'm sure. My first thought was to obtain the value for each key and check the class type with isa, but I see that's deprecated in macOS 13 with no replacement. I don't see another way to check the class. I'm sure other people have solved the same problem, but my searches have not turned up any answers.
3
0
256
3w
Tokens change without reason after updating to iOS 17.5.1
Some of our users encounter an issue after updating their iPhone/iPad to iOS 17.5.1. The tokens passed in the Shield Configuration extension don't match the tokens they selected in my app using the FamilyPicker before updating to iOS 17.5.1. It seems the tokens changed for no reason. My app can't match the token from the ShieldConfigurationDataSource to any tokens stored on my end, causing my shield screens to turn blank. The same applies to tokens in the Device Activity Report extension. The only workaround I've found is to tell affected users to unselect and reselect apps and websites to block in my app. This gets them new tokens from the FamilyActivityPicker, which solves the issue. However, for some users, the bug reoccurs a few days later. Tokens seem to change again, causing the same issue in the Shield Configuration extension. I am not able to reproduce the issue on my test devices so I have no sysdiagnose to attach. However, this issue is affecting other screen time apps: https://developer.apple.com/forums/thread/732845 https://forums.developer.apple.com/forums/thread/756440 FB14082790 FB14111223 A change in iOS 17.5.1 must have triggered this behaviour. Could an Apple engineer give us any updates on this?
8
6
1.4k
Jun ’24
BGTaskScheduler crashes on iOS 18.4
I've been seeing a high number of BGTaskScheduler related crashes, all of them coming from iOS 18.4. I've encountered this myself once on launch upon installing my app, but haven't been able to reproduce it since, even after doing multiple relaunches and reinstalls. Crash report attached at the bottom of this post. I am not even able to symbolicate the reports despite having the archive on my MacBook: Does anyone know if this is an iOS 18.4 bug or am I doing something wrong when scheduling the task? Below is my code for scheduling the background task on the view that appears when my app launches: .onChange(of: scenePhase) { newPhase in if newPhase == .active { #if !os(macOS) let request = BGAppRefreshTaskRequest(identifier: "notifications") request.earliestBeginDate = Calendar.current.date(byAdding: .hour, value: 3, to: Date()) do { try BGTaskScheduler.shared.submit(request) Logger.notifications.log("Background task scheduled. Earliest begin date: \(request.earliestBeginDate?.description ?? "nil", privacy: .public)") } catch let error { // print("Scheduling Error \(error.localizedDescription)") Logger.notifications.error("Error scheduling background task: \(error.localizedDescription, privacy: .public)") } #endif ... } 2025-02-23_19-53-50.2294_+0000-876d2b8ec083447af883961da90398f00562f781.crash
11
3
614
1w