In info.plist file I configured URL Identifier and URL Scheme successfully. Also I am able to open app using custom URL. The problem is when app la
Maybe this will help your situation.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
let urlinfo = connectionOptions.urlContexts
let url = urlinfo.first?.url as! NSURL
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set) {
let url = URLContexts.first!.url as NSURL
}
My situation was that the openURL extra function provided in the SceneDelegate was not being called after returning from Facebook Authentication.
The solution was using
.onOpenURL { (url) in
ApplicationDelegate.shared.application(
UIApplication.shared,
open: url,
sourceApplication: nil,
annotation: [UIApplication.OpenURLOptionsKey.annotation]
)
}
To call the function in my extra application delegate, which then worked properly.
I had the same problem, and the method scene(_ scene:, continue userActivity:) was only called when the app is open.
When I checked the connectionOptions passed to the method scene(_ scene:, willConnectTo session, options connectionOptions:) it had a user activity with the expected URL. So, I ended up calling the first method manually:
func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
if let userActivity = connectionOptions.userActivities.first {
self.scene(scene, continue: userActivity)
}
}