3

As per my App project setup, I have following function calls with same code to instantiate rootVCs in SceneDelegate and AppDelegate respectively

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

}

func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?)
        -> Bool {
}




In order to Implement Universal Links, I have the following callback function in my App Delegate



func application(_ application: UIApplication,
                     continue userActivity: NSUserActivity,
                     restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
//code to capture and setup universal link
}


This function from AppDelegate is only called in less than iOS 13 devices.I looked for similar callback equivalent for SceneDelegate, The closest I could find was this function.



func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
//code to capture and setup universal link
}

Configuration: Xcode Version 11.5 target iOS 10+ devices. 
Problem: This particular callback is only called when there is an instance of the app running before Link is clicked. i.e. Once the App instance is killed, this function from SceneDelegate is not called and universal links Do not work for iOS13+ Devices.

I tried following this Xcode 11 - Opt out of UISceneDelegate/SwiftUI on iOS 13 to remove the Scene Delegate altogether, However ended up with only Black Screen. Question: What am I doing wrong and what is the possible fix?



Sameeh Ahmed
  • 53
  • 1
  • 11
  • Still trying to debug this, but I believe you need to implement: ```swift func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { ``` – David Jul 17 '20 at 00:35
  • Yes, I have implemented that (as seen in code snippet above). I couldn't find any solution to this. worked around by Removing Scene Delegate from my project completely to get Callback work right. – Sameeh Ahmed Jul 17 '20 at 11:35

0 Answers0