I'm using both Google+ and Facebook in my app.
My problem is that both of them require the OpenURL method in the appDelegate.
For Facebook login:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
For Google+ login:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return GPPURLHandler.handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}
How can I use both google+ and facebook in the same app?
Solution Updated for Xcode 7.0 and Swift 2.0
return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String, annotation: nil) ||
GPPURLHandler.handleURL(url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String, annotation: nil)
**
Swift 3.0 another solution
**
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if url.scheme == "fb1675189366130133" {
return FBSDKApplicationDelegate.sharedInstance().application(application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
}else{
return GIDSignIn.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation)
}
}
I found a solution, use this bit of code:
if url.scheme == "fb1111111111111" {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
} else {
return GPPURLHandler.handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}