Currently I am trying to find a work around to fetch data from server and update user defaults when app is forced quit. Can anyone suggest for this ?
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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I’m looking for an authoritative answer on how BGAppRefreshTask behaves after a user force-quits an app (swipes it away in the App Switcher).
My app relies on early-morning background refresh to prepare and schedule notifications based on user-defined thresholds and weather forecasts.
Behavior across devices seems inconsistent, however: sometimes a scheduled background refresh still runs, and other times it appears completely blocked.
Apple’s documentation doesn’t clearly state what should happen, and developer discussions conflict.
Could someone from Apple please clarify:
Will a previously scheduled BGAppRefreshTask run after the user force-quits the app?
If not, is there a recommended alternative for time-sensitive updates that must schedule user alerts?
What is the expected system behavior regarding the predictability of background refresh after a force-quit?
A definitive answer would help ensure the app aligns with intended system behavior.
Thanks!
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line:
Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive.
Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore.
During the archival phase now I am even getting this warning:
MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory.
How can I solve this issue?
If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before.
Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
Since integrating MapKit JS, we’ve begun receiving production error reports with the following message:
Uncaught DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': ArrayBuffer is not detachable and could not be cloned.
It appears that MapKit JS’s internal worker occasionally calls postMessage() with an ArrayBuffer that cannot be detached under Chrome 120+. This causes the structured clone to fail and the error surfaces uncaught from within the worker.
MapKit JS Version: 5.79.109
Browser: Chrome 120.0+
OS: Windows 10
Is this a known issue with MapKit JS? If so, are there recommended workarounds or planned fixes?
When syncing an Office 365 (Exchange) account on an M1 Max machine running the latest macOS (e.g., Sonoma), the native contactsd and AddressBookManager processes enter a severe, persistent failure loop. The CPU usage spikes from 0.0% to over 80% (observed at 81%) and repeats every 60-90 seconds. This occurs even when the account is entirely empty of contacts and after performing a clean macOS installation, strongly indicating a systemic bug in the framework's Exchange protocol handler on the M1 architecture.
System Information
Affected Hardware: Apple M1 Max
Affected macOS Version: Tahoe 26.1
Affected Processes: contactsd, AddressBookManager
Account Type: Microsoft Exchange / Office 365
Steps to Reproduce
System Setup: Perform a clean installation of macOS on the M1 Max machine (USB boot, NO Migration Assistant or data restoration).
Account Preparation: Ensure the target Exchange account's contacts folder is entirely empty on the server (via Outlook Web Access).
Trigger: Go to System Settings > Internet Accounts and add the Exchange account. Ensure ONLY Contacts is toggled ON.
Observation: Open Activity Monitor and sort by % CPU.
Expected Behavior
The contactsd and AddressBookManager processes should spike briefly (under 5%) to establish the empty sync, then settle to a persistent idle state (0.0% to 0.5% CPU).
Actual Behavior
The processes never settle:
CPU Spikes: Usage repeatedly jumps from 0.0% to 81% for AddressBookManager and 22-59% for contactsd.
Pattern: This extreme spike lasts for a few seconds before the thread crashes/restarts, and the process immediately re-initiates the loop, consuming massive CPU cycles continuously.
Diagnostic Proof
The runaway CPU is not caused by corrupt data:
Data Neutralization: The account's contacts folder was emptied on the server, yet the high CPU loop persisted when syncing.
Clean System: The issue is reproducible on a clean, from-scratch macOS installation, ruling out corrupted user preferences or system files.
Cross-Architecture: The exact same account syncs perfectly on iOS and newer M4 Macs, confirming the data is valid and the issue is specific to the M1 Max's implementation of the Exchange protocol handler.
Workaround (For Visibility)
To restore system performance, the user must DELETE the entire Exchange account from System Settings > Internet Accounts and use a third-party client (e.g., Outlook for Mac) for synchronization, as it bypasses the buggy native framework.
Topic:
App & System Services
SubTopic:
General
Hello,
I am currently implementing External Purchase Link and External Purchase Custom Link and am encountering an issue where both
ExternalPurchaseLink.canOpen and ExternalPurchaseCustomLink.isEligible always return false under all test conditions.
I would like to confirm whether my setup is missing any required steps or whether this behavior is expected.
Below are the details of my current environment and configuration:
🔧 1. Development Environment
Xcode: 16.3, 16.4, 26.0 beta 4
Devices:
iPhone running iOS 26.2 beta
iPhone running iOS 16.7.12
macOS 15.5 (real device testing)
Simulator iOS 18.0
Build Type: Local development build using a Developer Provisioning Profile
Sandbox account signed in during testing
🔑 2. Entitlements (Developer site & Xcode)
In Certificates → Identifiers → App ID, both capabilities are enabled:
StoreKit External Purchase
StoreKit External Purchase Link
The .entitlements file in Xcode includes:
com.apple.developer.storekit.external-purchase = YES
com.apple.developer.storekit.external-purchase-link = YES
The Provisioning Profile also contains both entitlements (confirmed via codesign -d --entitlements :-).
📄 3. Info.plist Configuration
Both keys are configured with correct region codes according to documentation:
SKExternalPurchase
SKExternalPurchaseCustomLinkRegions
🌍 4. Test Storefront
Device storefront verified as United States (US) or Portugal (PT) (US = target region for External Purchase Link, PT = EU region)
But despite all the above configuration,
both API calls consistently return false:
ExternalPurchaseLink.canOpen // false
ExternalPurchaseCustomLink.isEligible // false
So I cannot proceed to testing the remaining flow (token retrieval, link opening, etc.)
------ Questions ------
❓ Q1) Local Development Build Limitation
Is it expected behavior that Developer-signed local builds always return
canOpen = false / isEligible = false
for External Purchase Link & Custom Link?
Is there a technical or policy restriction that prevents eligibility in local dev builds?
❓ Q2) App Store Connect Configuration Requirement
Are there mandatory App Store Connect settings (such as external purchase URLs, support URL, disclosures, or country configuration) that must be enabled before eligibility becomes true?
Currently, no External Purchase Link or Custom Link menu is visible in my App Store Connect app settings.
Is this menu only available after certain approvals or under specific conditions?
❓ Q3) TestFlight Requirement
Do External Purchase Link and Custom Link only return eligibility = true on:
TestFlight builds, or
Distribution-signed builds?
Or should eligibility also work on developer builds?
Formal confirmation would be helpful.
❓ Q4) Developer Account Type Limitation
We are using an Individual Developer Account (not Organization).
Can Individual accounts fully request, test, and ship apps using:
External Purchase Link
External Purchase Custom Link
Or are there limitations on account type?
🙏 Request
We have completed all documented setup steps (Entitlements → Provisioning → Info.plist),
but eligibility remains false, blocking feature validation.
Please clarify which of the following is the cause:
Local development builds do not support eligibility
Missing App Store Connect configuration (not visible to us)
Account type restriction
Region rollout or entitlement approval requirement
Any additional setup not documented publicly
Thank you for your assistance.
For Apple Pay Testing purposes, we're trying out cards from https://developer.apple.com/apple-pay/sandbox-testing/
Visa, AMEX, Discover cards can be added to the wallet.
But all 5 of the listed options for Mastercard cannot be added to the wallet with the error "Card Device Limit".
How can we resolve this?
Topic:
App & System Services
SubTopic:
Apple Pay
Tags:
Apple Pay on the Web
Apple Pay
Tap to Pay on iPhone
There is a project that has been running online for years. A few months ago, a player reported that after making their first successful IAP at a specific purchase point, any subsequent attempts to purchase the same item do not trigger the payment window. Instead, they get the error:"This in-app purchase has already been bought".After contacting Apple Support once, the player was able to make a payment, but the issue reappeared on the next attempt. So far, this is the only user reporting the problem, other people can purchase normally.
Question1:
Here’s what I’ve tried:
I reviewed the code and ensured that TransactionObserveris correctly called.
I’ve also added **[[SKPaymentQueue defaultQueue] finishTransaction:transaction]**in all possible places, but the issue persists.
According to the logs, after the user’s first purchase, every subsequent IAP attempt returns the same receipt from the initial successful transaction, even though I’m certain finishTransactionis being called. It seems like this method isn’t having the intended effect.
Question2:
I asked the player to manually trigger the Restore Purchases button by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions].
the restoreCompletedTransactionsFailedWithErrorcallback returned the following error:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made."
The player has already checked their device time and tried switching between Wi-Fi and 4G, but the error remains. Is this SSL error related to the "already bought" error? Note that this SSL issue occurred during a separate restore process, not during a purchase attempt.
Question: 3:
I noticed that I’m not calling finishTransaction inside the restoreCompletedTransactionsFailedWithErrorcallback. Should I add it there?
Purchase Logs:
The player clicked "Restore Purchases" and then attempted another purchase. The purchase flow appears normal, but the IAP returns an old, already-used receipt.
[2025-12-10 17:41:38:995] Restore transaction failed: Error > Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a > secure connection to the server cannot be made."
[2025-12-10 17:41:40:010] Restore transaction failed: Error > Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a > secure connection to the server cannot be made."
[2025-12-10 17:41:42:011] buy method called... productID: > huoxiancj_648 orderID: 22674511
[2025-12-10 17:41:42:107] ----Log Observers ID----
[2025-12-10 17:41:42:108] ObserverID: 0x109968890
[2025-12-10 17:41:42:108] Processing unfinished transactions...
[2025-12-10 17:41:42:108] Finished processing unfinished > transactions.
[2025-12-10 17:41:42:108] Allowing in-app purchase...
[2025-12-10 17:41:42:215] Requesting product info...
[2025-12-10 17:41:42:989] productsRequest didReceiveResponse:
[2025-12-10 17:41:43:066] Invalid Product ID: (
[2025-12-10 17:41:43:066] Purchase quantity: 1
[2025-12-10 17:41:43:066] Product info:
[2025-12-10 17:41:43:067] Price: 648
[2025-12-10 17:41:43:067] Product ID: huoxiancj_648
[2025-12-10 17:41:43:067] Validating product info...
[2025-12-10 17:41:43:067] Sending payment request...
[2025-12-10 17:41:43:067] requestDidFinish
[2025-12-10 17:41:43:132] paymentQueue updatedTransactions.
[2025-12-10 17:41:43:133] updatedTransactions case > SKPaymentTransactionStatePurchasing
[2025-12-10 17:41:43:208] [payment.applicationUsername] > userid=50306496 appid=1045 instid=12844 reserve=xxxx > productID=22674511
[2025-12-10 17:43:16:008] paymentQueue updatedTransactions.
[2025-12-10 17:43:16:008] updatedTransactions case > SKPaymentTransactionStatePurchased
[2025-12-10 17:43:16:008] productIdentifier= huoxiancj_648
[2025-12-10 17:43:16:113] Sending receipt to server for validation.
[2025-12-10 17:43:16:113] Transaction completed.
Any help or suggestions would be greatly appreciated! Thanks in advance.
Hello,
I’m experiencing a strange issue with a newly created Subscription Group in my iOS app.
For all my existing subscription groups, everything works perfectly — initial purchase, renewals, cancellations, all notifications arrive normally.
But for this one newly created group, the first purchase never triggers any server notification from App Store Server Notifications (ASSN).
⸻
📘 Problem Summary
• I created a new Subscription Group in App Store Connect.
• The products are all Approved and Published for over a week.
• Users can successfully purchase the subscription in production.
• The purchase is shown as Purchased in the App Store purchase UI.
• The receipt can be fetched locally on device.
• But my server receives no notifications, including:
• DID_RENEW
• DID_CHANGE_RENEWAL_STATUS
• SUBSCRIBED
• ONE_TIME_CHARGE
• CONSUMPTION_REQUEST
• etc.
The old subscription groups still send notifications normally, so the notification URL and server infrastructure are correct.
Honestly, don't know how to test it in sandbox. I'm confused on if I need a sandbox to actually test out my in app purchase. Do I need to download something? Someone please help.
Topic:
App & System Services
SubTopic:
StoreKit
We have an app in Swift that uses push notifications. It has a deployment target of iOS 15.0
I originally audited our app for iOS 26 by building it with Xcode 26 beta 3. At that point, all was well. Our implementation of application:didRegisterForRemoteNotificationsWithDeviceToken was called.
But when rebuilding the app with beta 4, 5 and now 6, that function is no longer being called.
I created a simple test case by creating a default iOS app project, then performing these additional steps:
Set bundle ID to our app's ID
Add the Push Notifications capability
Add in application:didRegisterForRemoteNotificationsWithDeviceToken: with a print("HERE") just to set a breakpoint.
Added the following code inside application:didFinishLaunchingWithOptions: along with setting a breakpoint on the registerForRemoteNotifications line:
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { granted, _ in
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
Building and running with Xcode 26 beta 6 (17A5305f) generates these two different outcomes based upon the OS running in the Simulator:
iPhone 16 Pro simulator running iOS 18.4 - both breakpoints are reached
iPhone 16 Pro simulator running iOS 26 - only the breakpoint on UIApplication.shared.registerForRemoteNotifications is reached.
Assuming this is a bug in iOS 26. Or, is there something additional we now need to do to get push notifications working?
I just saw another post regarding bookmarks on iOS where an Apple engineer made the following statement:
[quote='855165022, DTS Engineer, /thread/797469?answerId=855165022#855165022'] macOS is better at enforcing the "right" behavior, so code that works there will generally work on iOS. [/quote]
So I went back to my macOS code to double-check. Sure enough, the following statement:
let bookmark = try url.bookmarkData(options: .withSecurityScope)
fails 100% of the time.
I had seen earlier statements from other DTS Engineers recommending that any use of a URL be bracketed by start/stopAccessingSecurityScopedResource. And that makes a lot of sense. If "start" returns true, then call stop. But if start returns false, then it isn't needed, so don't call stop. No harm, no foul.
But what's confusing is this other, directly-related API where a security-scoped bookmark cannot be created under any circumstances because of the URL itself, some specific way the URL was initially created, and/or manipulated?
So, what I'm asking is if someone could elaborate on what would cause a failure to create a security-scoped bookmark? What kinds of URLs are valid for creation of security-scoped bookmarks? Are there operations on a URL that will then cause a failure to create a security-scoped bookmark? Is it allowed to pass the URL and/or bookmark back and forth between Objective-C and Swift?
I'm developing a new macOS app for release in the Mac App Store. I'm initially getting my URL from an NSOpenPanel. Then I store it in a SQLite database. I may access the URL again, after a restart, or after a year. I have a login item that also needs to read the database and access the URL.
I have additional complications as well, but they don't really matter. Before I get to any of that, I get a whole volume URL from an NSOpen panel in Swift, then, almost immediately, attempt to create a security-scoped bookmark. I cannot. I've tried many different combinations of options and flows of operation, but obviously not all.
I think this started happening with macOS 26, but that doesn't really matter. If this is new behaviour in macOS 26, then I must live with it.
My particular use requires a URL to a whole volume. Because of this, I don't actually seem to need a security-scoped bookmark at all. So I think I might simply get lucky for now.
But this still bothers me. I don't really like being lucky. I'd rather be right. I have other apps in development where this could be a bigger problem. It seems like I will need completely separate URL handling logic based on the type of URL the user selects.
And what of document-scoped URLs? This experience seems to strongly indicate that security-scoped URLs should only ever be document-scoped. I think in some of my debugging efforts I tried document-scoped URLs. They didn't fix the problem, but they seemed to make the entire process more straightforward and transparent. Can a single metadata-hosting file host multiple security-scoped bookmarks? Or should I have a separate one for each bookmark?
But the essence of my question is that this is supposed to be simple operation that, in certain cases, is a guaranteed failure. There are a mind-bogglingly large number of potential options and logic flows. Does there exist a set of options and logic flows for which the user can select a URL, any URL, with the explicit intent to persist it, and that my app can save, share with helper apps, and have it all work normally after restart?
I want to detect if the adapter is connected to the iPhone even if no IP has been given to the iPhone. I can detect that the interface is connected when the iPhone has been given an IP address, but how can I detect the adapter when not?
Topic:
App & System Services
SubTopic:
Networking
After reading the news below, we are currently working on updating our app in preparation for the enforcement of Texas SB 2420.
https://developer.apple.com/news/?id=2ezb6jhj
Based on the information in the announcement, we understand that parents will be able to revoke their consent for apps.
However, we are unsure how an app is supposed to obtain or verify the parent’s consent status in the first place.
We reviewed the Declared Age Range API and PermissionKit’s Significant Change API, but could not find any functionality related to this.
If anyone with expertise on this topic has insight, we would greatly appreciate your guidance.
Thank you in advance.
After reading the news below, we are currently working on updating our app in preparation for the enforcement of Texas SB 2420.
https://developer.apple.com/news/?id=2ezb6jhj
Based on the information in the announcement, we understand that parents will be able to revoke their consent for apps.
However, we are unsure how an app is supposed to obtain or verify the parent’s consent status in the first place.
We reviewed the Declared Age Range API and PermissionKit’s Significant Change API, but could not find any functionality related to this.
If anyone with expertise on this topic has insight, we would greatly appreciate your guidance.
Thank you in advance.
We attempted to run a burn-in test while connected to our MacBook Pro M4 Max, but this crashed about 10 minutes into testing. Can Action Star see if you are able to run a 2-hour burn-in on your own M4 Max host while charging the battery from below 5%, running six bus-powered drives (via ATTO/Black Magic/IOmeter), hitting the RJ45 port for 2.5Gbps (via JPerf), and streaming at least 4K60Hz video content to two displays? Please measure the outer temperature on the hottest part of the enclosure as well.
We are facing a DNS resolution issue with a specific ISP, where our domain name does not resolve correctly using the system DNS. However, the same domain works as expected when a custom DNS resolver is used.
On Android, this is straightforward to handle by configuring a custom DNS implementation using OkHttp / Retrofit. I am trying to implement a functionally equivalent solution in native iOS (Swift / SwiftUI).
**Android Reference (Working Behavior) : **
val dns = DnsOverHttps.Builder()
.client(OkHttpClient())
.url("https://cloudflare-dns.com/dns-query".toHttpUrl()) .bootstrapDnsHosts(InetAddress.getByName("1.1.1.1")).build()
OkHttpClient.Builder().dns(dns).build()
**Attempted iOS Approach **
I attempted the following approach :
Resolve the domain to an IP address programmatically (using DNS over HTTPS)
Connect directly to the resolved IP address
Set the original domain in the Host HTTP header
**DNS Resolution via DoH : **
func resolveDomain(domain: String) async throws -> String {
guard let url = URL(
string: "https://cloudflare-dns.com/dns-query?name=\(domain)&type=A"
) else {
throw URLError(.badURL)
}
var request = URLRequest(url: url)
request.setValue("application/dns-json", forHTTPHeaderField: "accept")
let (data, _) = try await URLSession.shared.data(for: request)
let response = try JSONDecoder().decode(DNSResponse.self, from: data)
guard let ip = response.Answer?.first?.data else {
throw URLError(.cannotFindHost)
}
return ip
}
**API Call Using Resolved IP : **
func callAPIUsingCustomDNS() async throws {
let ip = try await resolveDomain(domain: "example.com")
guard let url = URL(string: "https://\(ip)") else {
throw URLError(.badURL)
}
let configuration = URLSessionConfiguration.ephemeral
let session = URLSession(
configuration: configuration,
delegate: CustomURLSessionDelegate(originalHost: "example.com"),
delegateQueue: .main
)
var request = URLRequest(url: url)
request.setValue("example.com", forHTTPHeaderField: "Host")
let (_, response) = try await session.data(for: request)
print("Success: \(response)")
}
**Problem Encountered **
When connecting via the IP address, the TLS handshake fails with the following error:
Error Domain=NSURLErrorDomain Code=-1200
"A TLS error caused the secure connection to fail."
This appears to happen because iOS sends the IP address as the Server Name Indication (SNI) during the TLS handshake, while the server’s certificate is issued for the domain name.
**Custom URLSessionDelegate Attempt : **
class CustomURLSessionDelegate: NSObject, URLSessionDelegate {
let originalHost: String
init(originalHost: String) {
self.originalHost = originalHost
}
func urlSession(
_ session: URLSession,
didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
) {
guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,
let serverTrust = challenge.protectionSpace.serverTrust else {
completionHandler(.performDefaultHandling, nil)
return
}
let sslPolicy = SecPolicyCreateSSL(true, originalHost as CFString)
let basicPolicy = SecPolicyCreateBasicX509()
SecTrustSetPolicies(serverTrust, [sslPolicy, basicPolicy] as CFArray)
var error: CFError?
if SecTrustEvaluateWithError(serverTrust, &error) {
completionHandler(.useCredential, URLCredential(trust: serverTrust))
} else {
completionHandler(.cancelAuthenticationChallenge, nil)
}
}
}
However, TLS validation still fails because the SNI remains the IP address, not the domain.
I would appreciate guidance on the supported and App Store–compliant way to handle ISP-specific DNS resolution issues on iOS. If custom DNS or SNI configuration is not supported, what alternative architectural approaches are recommended by Apple?
As per the US state law including SB2420 in Texas.
We are suppose to meet their compliance.
We have following queries
Could you please confirm whether the provided Declared Age Range API framework is available for sandbox testing
How does the API respond for a region other than Texas
We tested call blocking on iOS 26 and noticed something strange: the call will not be blocked if an outgoing call was made to its number before. Nevertheless, it will be blocked if we delete the outgoing call record from the Phone.app Recents.
This behavior looks like a bug and is unexpected when using our application. Was this a planned callkit change in iOS 26? Is it possible to get the correct call blocking behavior back?
We set blocking rules with addBlockingEntry(withNextSequentialPhoneNumber:) and this problem is not present in iOS 18 and earlier.
Thank you in advance
Hello,
I have an app that was using the iOS 18 Network Framework APIs. It used Peer to Peer, QUIC and Bonjour. It was all working as expected. I wanted to upgrade to the new iOS 26 Network Framework APIs (NetworkBrowser, NetworkListener, NetworkConnection...).
I have things working (multiple devices can discover each other, connection to each other and send messages to each other) but my app crashes when I go to toggle of all the networking stuff.
In the iOS 18 Network Framework API NWConnection had a .cancel() function I could use to tell the other side the connection was done.
I dont see a cancel function for NetworkConnection.
My question is - how do I properly close down a NetworkConnection and also properly tell the other side the connection is done.