I am trying to test my app clip's url handler by running the app clip from Xcode. However the URL method handler (SceneDelegate's continue method) never gets called, contrary to Apple's documentation documentation, which states:
For a UIKit-based app clip and full app that support scene-based app life-cycle events, implement the callbacks defined in UISceneDelegate. For example, implement scene(_:continue:) callback to access the user activity object.
For a UIKit-based app clip and full app that respond to app-based life-cycle events, implement the callbacks defined in UIApplicationDelegate. Be sure to implement the application(:continue:restorationHandler:) callback, because you don’t have access to the NSUserActivity object in application(:didFinishLaunchingWithOptions:).
- The app delegate does not implement the
application(_:continue:restorationHandler:)method - The app clip's scheme has the _XCApplClipURL parameter enabled and set to
https://fruits.com/check?fruit_name=bananas - The app clip's
Associated Domainlistsappclips:fruits.com - The app clip's
SceneDelegateis as follows
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
// UGHH!!! Never gets called
print("AppClip invocation url is : \(incomingURL)")
}
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// OK!! This gets called
guard let _ = (scene as? UIWindowScene) else { return }
}
}
I have been banging my head on the walls for the last 2 days. What am I missing?
Note: I am using this sample app available in github, just modified the signing configuration to get the app clip to compile & run.