I'm trying to integrate facebook and google login into my app but having a problem: Both require the following to be added into the openURL method in the Appdelegate:
return [GIDSignIn sharedInstance] handleURL:url
sourceApplication:sourceApplication
annotation:annotation]];
return [FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
]]
Is there anyway of having these both work together properly. I've looked online but the answers are quite vague and fail to provide a good explanation
Solution
Added the following which did the trick for me (as of iOS 9):
return [[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation] || [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation ];
Updated Answer
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
let urlString = url.absoluteString
if urlString.contains("fb"){
ApplicationDelegate.shared.application(
app,
open: url,
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
)
}
else{
}
return GIDSignIn.sharedInstance().handle(url)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With