According to the documentation, using Scope(restriction: .none) can expose the extension point to third-party app extensions. Below is my implementation, which ultimately results in an error.
Code for declaring the extension point:
@available(iOS 26.0, *)
extension AppExtensionPoint {
@Definition
static var priceExtension: AppExtensionPoint {
Name("priceExtension")
UserInterface(false)
Scope(restriction: .none)
}
}
Code for locating the extension point:
monitor = try await AppExtensionPoint.Monitor(appExtensionPoint: .priceExtension)
When executing the code to locate the extension point, the following error occurs:
However, in practice, I found that declaring the extension point in this way results in an error when trying to locate it:
Error Domain=com.apple.extensionKit.errorDomain Code=19 "Failed to add observer" UserInfo={NSLocalizedDescription=Failed to add observer}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if (application.applicationState == UIApplicationStateBackground) {
// ✅ Background launch
} else {
// ✅ Normal foreground launch
}
}
Previously, when using AppDelegate to handle lifecycle methods, I could determine whether a cold start was a background launch as shown above. This allowed me to accurately measure cold start time for real-world users.
The platform now requires migration to scene-based lifecycle management by iOS 16. However, after migration:
In both application:didFinishLaunchingWithOptions: and scene:willConnectToSession:options: methods,
application.applicationState == UIApplicationStateBackground and scene.activationState == UISceneActivationStateUnattached
These values remain fixed regardless of whether it's a background launch, making them unusable for differentiation.
I attempted to use information from UISceneConnectionOptions for distinction but found it ineffective.
Question: Are there alternative approaches to achieve this distinction?