Posts under App & System Services topic

Post

Replies

Boosts

Views

Activity

HTTP 400 status code
Recently, we completed a merger with our parent company. We are currently integrated with Apple Pay in accordance with the “Apple Pay Payment Processing on the Web” guidelines. Due to the change in the legal entity, we proceeded with the account migration process as outlined below: Creation of a new Apple Developer account and a new Apple Pay Identifier Removal of the Merchant Domain (dc2-web.happy.co.kr) from the existing Identifier Registration of the Merchant Domain (dc2-web.happy.co.kr) under the new Identifier Using the Merchant Domain registered under the new Identifier and the Apple Pay Merchant Identity Certificate issued from the new Identifier, we attempted to obtain an Apple Pay session by sending requests to the following endpoint: https://apple-pay-gateway.apple.com/paymentservices/startSession However, we are intermittently receiving failure responses with an HTTP 400 status code. With regard to these intermittent failures, we would like to inquire whether there is any propagation delay on Apple’s servers when an Apple Pay Identifier is removed and re-registered under a new account, or if there could be any other possible causes for this behavior. We would appreciate your guidance on this matter.
0
0
71
3d
iOS应用图标右上角的未读数无法清除
手机型号:iPhone 13 Pro iOS版本号:iOS 18.6.2 (22G100) 用户开启了应用的系统通知功能,在收到离线推送后应用右上角展示未读消息数。在APP启动或者从后台恢复的时候,应用会用如下方法清理应用桌面图标的未读数角标。但是在部分机型上,应用转为“后台模式”时仍然会出现一个未读角标,且每次都是一个固定值;如果直接kill进程就不会出现未读角标。请问如何能够【完全】清理消息未读数,确保不会在退后台的时候再次出现呢? [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] cancelAllLocalNotifications]; if (@available(iOS 16.0, *)) { [[UNUserNotificationCenter currentNotificationCenter] setBadgeCount:0 withCompletionHandler:nil]; [[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests]; [[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests]; } UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; content.badge = @(-1); UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"clearBadge" content:content trigger:nil]; [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { // Do nothing }];
0
0
57
3d
Extend Measurement to support inverse units
There are many units which are inverse of standard units, e.g. wave period vs Hz, pace vs speed, Siemens vs Ohms, ... Dimension can be subclassed to create the custom units. How to extend Measurement.converted( to: )? I was looking at somehow using UnitConverter and subclass to something like UnitConverterInverse. Thoughts?
1
1
151
2d
Bug? SwiftData + inheritance + optional many-to-one relationship
I've spent a few months writing an app that uses SwiftData with inheritance. Everything worked well until I tried adding CloudKit support. To do so, I had to make all relationships optional, which exposed what appears to be a bug. Note that this isn't a CloudKit issue -- it happens even when CloudKit is disabled -- but it's due to the requirement for optional relationships. In the code below, I get the following error on the second call to modelContext.save() when the button is clicked: Could not cast value of type 'SwiftData.PersistentIdentifier' (0x1ef510b68) to 'SimplePersistenceIdentifierTest.Computer' (0x1025884e0). I was surprised to find zero hit when Googling "Could not cast value of type 'SwiftData.PersistentIdentifier'". Some things to note: Calling teacher.computers?.append(computer) instead of computer.teacher = teacher results in the same error. It only happens when Teacher inherits Person. It only happens if modelContext.save() is called both times. It works if the first modelContext.save() is commented out. If the second modelContext.save()is commented out, the error occurs the second time the model context is saved (whether explicitly or implicitly). Keep in mind this is a super simple repro written to generate on demand the error I'm seeing in a normal app. In my app, modelContext.save() must be called in some places to update the UI immediately, sometimes resulting in the error seconds later when the model context is saved automatically. Not calling modelContext.save() doesn't appear to be an option. To be sure, I'm new to this ecosystem so I'd be thrilled if I've missed something obvious! Any thoughts are appreciated. import Foundation import SwiftData import SwiftUI struct ContentView: View { @Environment(\.modelContext) var modelContext var body: some View { VStack { Button("Do it") { let teacher = Teacher() let computer = Computer() modelContext.insert(teacher) modelContext.insert(computer) try! modelContext.save() computer.teacher = teacher try! modelContext.save() } } } } @Model class Computer { @Relationship(deleteRule: .nullify) var teacher: Teacher? init() {} } @Model class Person { init() {} } @available(iOS 26.0, macOS 26.0, *) @Model class Teacher: Person { @Relationship(deleteRule: .nullify, inverse: \Computer.teacher) public var computers: [Computer]? = [] override init() { super.init() } }
3
1
56
2d
Making sure uploads continue in background, but also works in foreground
Hello! I have read most of the "Background Tasks Resources" here https://developer.apple.com/forums/thread/707503 - but still have a few questions that I need clarified. To provide our context, our usecase is that our user wants to upload files to our servers. This is an active decision by the user to initiate the upload, but we also want make sure the files are uploaded, even if the user chooses to background our app. If we use a URLSession.backgroundto initiate the uploadTask, I understand that we are passing it of to the urlsession deamon to handle the upload. Which is great, if the user chooses to background our app. But, what if they just stay with the app in the foreground? Will it start uploading immediately? Can we expect the same latency that a standard URLSession will provide? And the potential delay will only occur if they actually background our app. Also, what happens if a background upload is in-progress and the user enters our app again? Will it gain priority, and run with similar latency as standard URL session? I.e., can we just always rely on using a background session, or should we kick of a beginBackgroundTask with a standard URL session, and only trigger a background uploadTask if we do not finish the standard upload before getting told we are about to get killed? A different question. I know there is the rate-limit delay added if we trigger multiple background URL tasks. Does that effect the following use case? We would like to send an additional HTTP request to our servers when the upload is completed, to notify it of the completion, but are we allowed to do that when the app is woken from the background? So, basically calling .dataTask from handleEventsForBackgroundURLSession for example?
1
0
74
2d
Clarifying the intended scope of DL-TDoA ranging in Nearby Interaction
Does DL-TDoA ranging in the Nearby Interaction framework support building a traditional RTLS-style TDoA localization system, where a device’s absolute position is computed from time-difference measurements across multiple deployed anchors, or is DL-TDoA strictly limited to system-managed, relative ranging and direction estimation (distance/direction) between nearby devices? If DL-TDoA ranging in Nearby Interaction is not intended to support traditional RTLS-style TDoA localization, is there any public documentation or reference material that describes the intended DL-TDoA architecture, such as the expected system setup, device roles, and deployment constraints (for example, how ranging is expected to be performed between an iPhone and nearby accessories), beyond the high-level API documentation? Regards.
0
0
23
3d
Apple Wallet Extension Implementation
Hello Dear Network, We are developing a banking application and are implementing Apple Wallet In-App Provisioning with Wallet UI and Non-UI extensions. Our App Store submission fails with the error: "Missing entitlement com.apple.developer.payment-pass-provisioning" for both Wallet UI and Non-UI extensions. In the Apple Developer portal, we do not see the "Apple Pay" or "In-App Provisioning" capabilities available for our App ID or extension App IDs. We would like to request enablement of: Apple Pay Payment Pass Provisioning In-App Provisioning for our Apple Developer Team and related App IDs. Please let us know what we need to do for can upload build with that Entitlements, what can be problem? Thank you.
0
0
41
3d
HealthKit backgroundDelivery is only triggering in the background while charging
HealthKit background delivery only triggers when charging. I have set step monitoring to hourly frequency. Despite step changes, callbacks fail to arrive after 3-4 hours on battery, but trigger immediately upon connecting power. Observed for 2 days: background updates are only received when charging. The device is not in Low Power Mode, and Background App Refresh is enabled for the app in Settings.
1
0
56
3d
How does one get the locale-specific character set encoding on a Cocoa App
If (in terminal) I type 'env', I'll see a line that looks like: LANG=en_GB.UTF-8 And I can parse that to get the 2-char 'en' locale-code, the sub-domain 'GB' and the character-set encoding of UTF-8. All well and good. However in a Cocoa app, I can't seem to find the equivalent for the "UTF-8" part. This is a cross-platform app, but at this point I'll go with any solution... I've tried: NSLocale *loc = NSLocale.currentLocale; NSString *lang = loc.localeIdentifier; setlocale(LC_ALL, NULL); char *text = nl_langinfo(CODESET); if (text) NSString *charset = [NSString stringWithUTF8String:text]; NSLog(@"lang:%@\nchar:%@\n",lang, charset); which displays: lang:en-GB char:US-ASCII Also tried: // Search for locale info by preferred environment variable NSProcessInfo *pi = NSProcessInfo.processInfo; NSDictionary<NSString *,NSString *> *env = pi.environment; NSString *spec = env[@"LC_ALL"]; if (spec == nil) spec = env[@"LC_CTYPE"]; if (spec == nil) spec = env[@"LANG"]; NSLog(@"spec:%@\n", spec); which displays: spec:(null) Also tried: CFStringEncoding sys = CFStringGetSystemEncoding(); CFStringRef enc = CFStringConvertEncodingToIANACharSetName(sys); NSString *nsEnc = (__bridge NSString *)enc; NSLog(@"iana:%@", nsEnc); enc = CFStringGetNameOfEncoding(sys); nsEnc = (__bridge NSString *)enc; NSLog(@"name:%@", nsEnc); CFStringEncoding compat = CFStringGetMostCompatibleMacStringEncoding(sys); enc = CFStringGetNameOfEncoding(compat); nsEnc = (__bridge NSString *)enc; NSLog(@"name:%@", nsEnc); which displays: iana:macintosh name:Western (Mac OS Roman) name:Western (Mac OS Roman) Any ideas ?
3
0
61
3d
I'm developing a macOS File Provider Extension and encountering a `-2014` (Extension not registered) error when using Testing Mode only.
File Provider Extension Testing Mode -2014 Error Issue I'm developing a macOS File Provider Extension and encountering a -2014 (Extension not registered) error when using Testing Mode only. Environment macOS: 13.0+ Xcode: Latest version Developer Account: Paid Developer Account Extension Type: NSFileProviderReplicatedExtension Current Status App ID Configuration App ID: kr.it.flux.FluxDrive2.FileProvider Capabilities: ✅ com.apple.developer.fileprovider.testing-mode (enabled) ❌ General com.apple.developer.fileprovider (not visible) Extension Configuration NSExtensionPointIdentifier: com.apple.fileprovider NSExtensionPrincipalClass: FluxDrive2FileProvider.FileProviderExtension Code Signing: Valid (Team Identifier verified) Info.plist: Valid Error Message Error Domain=NSFileProviderErrorDomain Code=-2014 The operation couldn't be completed. (NSFileProviderErrorDomain error -2014.) Underlying error: Error Domain=NSFileProviderErrorDomain Code=-2001 Extension cannot be used Attempted Solutions ✅ Verified and corrected Extension Info.plist ✅ Verified Extension code signing ✅ Added App Group (group.kr.it.flux.FluxDrive2) ✅ Clean Build and rebuild ✅ Verified installation in /Applications ❌ Attempted to enable Extension in System Settings (Testing Mode doesn't appear) Observations Extension is not actually loaded (FileProviderExtension.init() is never called) NSFileProviderManager.add(domain) immediately returns -2014 error Extension file is built correctly and included in the app bundle Questions Shouldn't Testing Mode allow testing of File Provider Extension? Why is the -2014 error occurring? The general com.apple.developer.fileprovider capability is not visible in Developer Portal. How can I enable it? Is it normal for Extension not to be registered in the system when using Testing Mode, or are additional settings required? Is the general File Provider capability mandatory for App Store submission? Additional Information Extension code correctly implements NSFileProviderReplicatedExtension protocol All required methods (item, enumerator, fetchContents, etc.) are implemented Network permission (com.apple.security.network.client) is configured Any help would be greatly appreciated!
1
0
46
3d
I'm developing a macOS File Provider Extension and encountering a `-2014` (Extension not registered) error when using Testing Mode only.
File Provider Extension Testing Mode -2014 Error Issue I'm developing a macOS File Provider Extension and encountering a -2014 (Extension not registered) error when using Testing Mode only. Environment macOS: 13.0+ Xcode: Latest version Developer Account: Paid Developer Account Extension Type: NSFileProviderReplicatedExtension Current Status App ID Configuration App ID: kr.it.flux.FluxDrive2.FileProvider Capabilities: ✅ com.apple.developer.fileprovider.testing-mode (enabled) ❌ General com.apple.developer.fileprovider (not visible) Extension Configuration NSExtensionPointIdentifier: com.apple.fileprovider NSExtensionPrincipalClass: FluxDrive2FileProvider.FileProviderExtension Code Signing: Valid (Team Identifier verified) Info.plist: Valid Error Message Error Domain=NSFileProviderErrorDomain Code=-2014 The operation couldn't be completed. (NSFileProviderErrorDomain error -2014.) Underlying error: Error Domain=NSFileProviderErrorDomain Code=-2001 Extension cannot be used Attempted Solutions ✅ Verified and corrected Extension Info.plist ✅ Verified Extension code signing ✅ Added App Group (group.kr.it.flux.FluxDrive2) ✅ Clean Build and rebuild ✅ Verified installation in /Applications ❌ Attempted to enable Extension in System Settings (Testing Mode doesn't appear) Observations Extension is not actually loaded (FileProviderExtension.init() is never called) NSFileProviderManager.add(domain) immediately returns -2014 error Extension file is built correctly and included in the app bundle Questions Shouldn't Testing Mode allow testing of File Provider Extension? Why is the -2014 error occurring? The general com.apple.developer.fileprovider capability is not visible in Developer Portal. How can I enable it? Is it normal for Extension not to be registered in the system when using Testing Mode, or are additional settings required? Is the general File Provider capability mandatory for App Store submission? Additional Information Extension code correctly implements NSFileProviderReplicatedExtension protocol All required methods (item, enumerator, fetchContents, etc.) are implemented Network permission (com.apple.security.network.client) is configured Any help would be greatly appreciated!
1
0
87
3d
how to handle verification step for in-app purchase?
a UK-based user is having trouble completing an in-app purchase. after going through the typical purchase flow (tapping the button to trigger the in-app purchase sheet, completing Face ID) they see this verification sheet appear over my app and have to go to their banking app to approve the purchase. after approving the purchase from their banking app, they tap "Payment confirmed on Mobile App" to close the sheet, but then see an alert that suggests the result is .userCancelled. the purchase does not seem to have completed. the user reports not being charged (despite numerous attempts). plus, i have a "restore purchases" function on App init that would've restored a purchase if it existed. i have implemented what i think is a typical Storekit.purchase() method (again, the message the user sees is for the .userCancelled case): func purchase(productId: String) async -> (Bool, String?) { guard let product = subscriptionProducts.first(where: { $0.id == productId }) else { return (false, "Product not found") } do { let result = try await product.purchase() switch result { case .success(let verification): switch verification { case .verified(let transaction): await transaction.finish() hasSubscription = true return (true, nil) case .unverified: return (false, "Transaction verification failed") } case .userCancelled: return (false, "No worries, take your time. 😌") case .pending: return (false, "Purchase is pending") u/unknown default: return (false, "Error purchasing product. If this keeps happening, please contact [email].") } } catch { return (false, "Error purchasing product: \(error.localizedDescription)") } } has anyone dealt with this issue? i was seeing an unusually high number of .userCancelled purchase events from users outside the US, and i'm wondering if some of them were genuine purchase attempts that were blocked by this verification step. 😕
1
0
30
3d
Text filtering: behavior of current message is affected by behavior of past message from same origin
If there is this situation: A text message is sent from a sender and gets classified as junk (by a text filtering extension) with the result that it gets send to the spam folder as expected. A text message with different content is sent from the same sender and gets classified as allowed, however it also gets sent to the spam folder. If the above is repeated but after step 1 the message is deleted, then in step 2 the message doesn't get sent to the spam folder. So the presence of the message from step 1 being in the spam folder is having an effect on the behavior of step 2. Expected beahavour (if so, why?), or a defect?
0
0
26
4d
UNNotificationAttachment preview intermittently missing (attachment-store URL becomes unreadable)
I have been fighting this problem for two months and would love any help, advice or tips. Should I file a DTS ticket? Summary We attach a JPEG image to a local notification using UNNotificationAttachment. iOS reports the delivered notification as having attachments=1, but intermittently no image preview appears in Notification Center. In correlated cases, the attachment’s UNNotificationAttachment.url (which points into iOS’s attachment store) becomes unreadable (Data(contentsOf:) fails) even though the delivered notification still reports attachments=1. This document describes the investigation, evidence, and mitigations attempted. Product / Component UserNotifications framework UNNotificationAttachment rendering in Notification UI (Notification Center / banner / expanded preview) Environment App: OnThisDay (SwiftUI, Swift 6) Notifications: local notifications scheduled with UNCalendarNotificationTrigger(repeats: false) Attachment: JPEG generated from PhotoKit (PHImageManager.requestImage) and written to app temp directory, then passed into UNNotificationAttachment. Test contexts: Debug builds (direct Xcode install) TestFlight builds (production signing) iOS devices: multiple, reproducible with long runs and user clearing delivered notifications Expected Result Delivered notifications with UNNotificationAttachment should consistently show the image preview in Notification Center (thumbnail and expanded preview), as long as the notification reports attachments=1. If the OS reports attachments=1, the attachment’s store URL should remain valid/readable for the lifetime of the delivered notification still present in Notification Center. Actual Result Intermittently: Notification Center shows no image preview even though the app scheduled the notification with an attachment and iOS reports the delivered notification as having attachments=1. When we inspect delivered notifications via UNUserNotificationCenter.getDeliveredNotifications, the delivered notification’s request.content.attachments.first?.url exists but is unreadable (attempting Data(contentsOf:) returns nil / throws), i.e. the backing attachment-store file appears missing or inaccessible. In some scenarios the attachment-store file is readable for hours while the notification is pending, and then becomes unreadable after the notification is delivered. Reproduction Scenarios (Observed) Next-day reminders show attachment-store unreadable after delivery 1. Schedule a one-shot daily reminder for next day (07:00 local time) with UNCalendarNotificationTrigger(repeats: false) and a JPEG attachment. 2. During the prior day, periodic background refresh tasks verify the pending notification’s attachment-store URL is readable (pendingReadable=true). 3. After the reminder is delivered the next morning, the delivered snapshot shows the delivered notification’s attachment-store URL is unreadable (readable=false) and Notification Center shows no preview. Interpretation: the attachment-store blob appears to become inaccessible around/after delivery, despite being readable while pending. Evidence and Instrumentation We added non-crashing diagnostic logging (Debug builds) around: Scheduling time Logged that we successfully created a UNNotificationAttachment from a unique temp file. Logged that UNUserNotificationCenter.add(request) succeeded. Queried pendingNotificationRequests() and logged the scheduled request’s attachment url.lastPathComponent (iOS attachment-store filename). Delivered time (when app becomes active) Called UNUserNotificationCenter.getDeliveredNotifications and logged: delivered count, attachment count attachment url.lastPathComponent whether Data(contentsOf: attachment.url) succeeds (readable=true/false) Content fingerprinting Fingerprinted the exact JPEG bytes we wrote (SHA-256 prefix + byte count). Logged the iOS attachment-store filename (url.lastPathComponent) returned post-scheduling. Decode validation probe (later addition) When Data(contentsOf:) succeeds, we validate it decodes as an image using CGImageSourceCreateWithData and log: UTI (e.g. public.jpeg) pixel width/height magic header bytes What we tried / Mitigations Proactive “self-heal” for pending notifications Change: during background refresh/foreground refresh, verify the pending daily reminder’s attachment-store URL readability. If it’s unreadable, reschedule with a new attachment (same trigger). Rationale: if iOS drops the store file before delivery, recreating could repair it. Result: We observed cases where pending remained readable but delivered became unreadable after delivery, so this doesn’t address all observed failures. It is still valuable hardening. Increase scheduling frequency / reschedule closer to fire time (proposed/considered) We discussed adding a debug mode to always recreate the daily reminder during background refresh tasks (or only within N hours of fire time) to reduce the time window between attachment creation and delivery. Status: experimental; not yet confirmed to resolve the “pendingReadable=true → delivered unreadable after delivery” failure. Impact The primary UX value of the daily reminder is the preview photo; missing previews degrade core functionality. Failures are intermittent and appear dependent on OS attachment-store behavior and Notification Center actions (clearing notifications), making them difficult to mitigate fully app-side. Notes / Questions for Apple 1. Is iOS allowed to coalesce/deduplicate UNNotificationAttachment storage across notifications? If so, what is the retention model when delivered notifications are removed? 2. If a delivered notification still reports attachments=1, should its attachment-store URL remain valid/readable while the notification is still present in Notification Center? 3. In “next-day” one-shot scheduling scenarios, can the attachment-store blob be purged between scheduling and delivery (or immediately after delivery) even if the notification remains visible? 4. Is there a recommended pattern to ensure attachment previews remain stable for long-lived scheduled notifications (hours to a day), especially when using UNCalendarNotificationTrigger(repeats: false)? Minimal Code Pattern (simplified) 1. Generate JPEG (PhotoKit → UIImage → JPEG Data). 2. Write to a unique temp URL. 3. Create attachment: UNNotificationAttachment(identifier: <uuid>, url: <tempURL>, options: [UNNotificationAttachmentOptionsTypeHintKey: "public.jpeg"]) 4. Schedule notification with a calendar trigger for the next morning.
1
0
26
4d
SwiftData crash on adding sort argument to Query
Experiencing a crash that is only reproducible on TestFlight or AppStore version of the app, note this does not happen when running from Xcode. I've isolated the problem to sort argument being added to @Query that fetches a model that sorts based on inherited property. To reproduce: @Model class SuperModel { var createdAt: Date = .now } @available(macOS 26.0, *) @Model class SubModel: SuperModel { } @Query(sort: \SubModel.createdAt, animation: .default) private var models: [SubModel]
1
0
48
4d
Clarification Needed: histogrammedTimeToFirstDraw vs histogrammedOptimizedTimeToFirstDraw in MetricKit
Hi Apple Developer Community, I'm implementing MetricKit launch performance tracking in our iOS app and need clarification on two properties: histogrammedTimeToFirstDraw histogrammedOptimizedTimeToFirstDraw The Documentation Problem: The official MetricKit documentation provides minimal explanation of these properties beyond their names. Based on naming conventions, I initially assumed: histogrammedTimeToFirstDraw = cold launches histogrammedOptimizedTimeToFirstDraw = warm/optimized launches Based on our measurements: The “optimized” metric appears only in a small fraction of launches The "optimized" metric is actually slower The naming suggests the opposite behavior Questions: What specific launch conditions does each metric measure? Why would "optimized" launches be slower and less frequent? Is histogrammedOptimizedTimeToFirstDraw related to iOS app pre-warming or prediction features? If these metrics don’t correspond to cold vs. warm launch times, is there an alternative way to measure them accurately? Any clarification from Apple or insights from developers who've tracked these metrics would be greatly appreciated.
0
0
57
4d
CLMonitor API Missing Geofence Entry Events After Initial Registration
We are experiencing a failure in CLMonitor event delivery when the application is launched into the background via an APNS (Remote Push Notification). Even when a CLBackgroundActivitySession is instantiated immediately upon background launch, CLCircularGeographicCondition "Enter" events are suppressed. The system fails to deliver these events until the user manually brings the application to the Foreground. This indicates that CLBackgroundActivitySession does not correctly maintain background persistence when the session begins in a background state rather than transitioning from the foreground. Comparison of API Behavior (Background State) Launch via APNS: CLMonitor: Fails to trigger "Enter" events until the app is manually brought to the foreground. Legacy API: Successfully triggers and delivers "Enter" events immediately upon background launch. Exit Event Reliability: CLMonitor: Reliably triggers exit events even in the background. Legacy API: Reliably triggers exit events. Foreground Dependency: CLMonitor: Requires a foreground transition to "flush" or activate the delivery of pending entry events. Legacy API: No foreground transition required; events are delivered directly to the background process. Event Recovery: CLMonitor: Relies on the developer re-instantiating the CLMonitor and awaiting the events stream, which appears to "stall" during warm-starts. Legacy API: Relies on the CLLocationManagerDelegate which remains active as long as the manager instance exists. Steps to Reproduce Preconditions: Location Permissions: Set to "Always Allow". Background Modes: "Location updates" and "Remote notifications" enabled. App State: Terminated or Killed (by the user or the OS). Reproduction Path: Trigger Background Launch: Send a silent push notification (APNS) to wake the app in the background. Initialize Session: Within the background launch sequence (e.g., didFinishLaunchingWithOptions), immediately create and hold a strong reference to a CLBackgroundActivitySession. Register Monitor: * Initialize CLMonitor using requestMonitorWithConfiguration. Add a geofence using addConditionForMonitoring with a CLCircularGeographicCondition. Simulate Entry: Move the physical device (or simulate location) into the geofence boundary while the app remains in the background state. Observe: No "Enter" event is received in the CLMonitor event stream. Foreground Transition: Bring the app to the foreground. Actual Result: The "Enter" event is only delivered the moment the app enters the Foreground. Expected Result: The CLBackgroundActivitySession should enable CLMonitor to deliver "Enter" events immediately in the background, parity with the deprecated startMonitoringForRegion API.
1
0
72
2d
Activating a Container App from a Custom Keyboard Extension to Enable Continuous Voice Input While Preserving the Original Typing Context
Project Background: I am developing a third-party custom keyboard for iOS whose primary feature is real-time voice input. In my current design, responsibilities are split as follows: 1. The container (main) app is responsible for: Audio recording Speech recognition (ASR) 2. The keyboard extension is responsible for: Providing the keyboard UI Initiating the voice input workflow Receiving transcription results via an App Group Inserting recognized text into the active text field using textDocumentProxy.insertText(_:) Intended User Flow The intended workflow is: The user is typing in a third-party app (for example, WeChat) using my custom keyboard. The user taps a “Voice Input” button in the keyboard extension. The keyboard extension activates the container app so that audio recording and ASR can begin. After recording has started, control returns to the original app where the user was typing. The container app continues running in the background, maintaining active audio recording and ASR. Recognized text is continuously streamed back to the keyboard extension and inserted into the current cursor position in real time. Observed Industry Behavior Some popular third-party keyboards on iOS, such as WeChat Keyboard and Doubao Keyboard, appear to provide a similar user experience in which: Voice input can be initiated directly from the keyboard while typing in another app. The user remains (or returns) in the original typing context after voice input starts. Speech recognition continues and text is streamed into the active text field without interrupting the typing experience. I would like to better understand how this type of workflow aligns with iOS platform capabilities and supported APIs. My Questions Is it supported by iOS public APIs for a custom keyboard extension to activate its container app to start audio recording and ASR, then return to the original host app while the container app continues recording and performing ASR in the background? If this workflow is not supported, are there any Apple-recommended or supported alternative architectures for achieving a similar user experience, especially when audio recording and ASR logic are currently implemented in the container app rather than in the keyboard extension? Goal My goal is to design a solution that is fully compliant with iOS public APIs and platform constraints, while providing a real-time voice input experience comparable to existing third-party keyboards on the platform. Any guidance on supported APIs, recommended architectures, or relevant documentation would be greatly appreciated.
3
0
101
4d