in https://developers.facebook.com/docs/ios/getting-started they say
iOS 13 moved opening URL functionality to the SceneDelegate. If you are using iOS 13, add the following method to your SceneDelegate so that operations like logging in or sharing function as intended:
// SceneDelegate.swift
import FacebookCore
...
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else {
return
}
ApplicationDelegate.shared.application(
UIApplication.shared,
open: url,
sourceApplication: nil,
annotation: [UIApplication.OpenURLOptionsKey.annotation]
)
}
but when I implement it in application:openURL:options: it's still work as expected. So do i really need to implement scene:openURLContexts: and why ? what the difference between the 2 functions ?
I found an interesting article which talks about it. Basically, if your app run on up to iOS 13 SceneDelegate is preferable than AppDelegate. In this case, even if you implement
application:openURL:options:,scene:openURLContexts:will be executed instead ofapplication:openURL:options:.Another basic difference between them is that openURLContexts can receive a Set of URLContexts instead of a simple URL, and URLContext is an object which has metadata besides the URL.