Duplicate method application:openURL [duplicate] - ios

user in my app can login using 2 services : Facebook or Google
everything works fine, however, in the :
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation: (id)annotation {
...
}
i should decide to call the Facebook callback or Google callback
if the user has the apps, its easy, than i decide by the sourceApplication
but when not (no native Facebook account linked in, no FB app, no GooglePlus app), it links to the browser :( and i dont know if it is comming from Facebook or Google
is there a way how to decide what to call? like
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation: (id)annotation {
// how to decide?
if (facebook) {
return [FBSession.activeSession handleOpenURL:url];
} else if (google) {
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
}

We don't need to Explicitly check the URL, the code below does it:
- (BOOL)application: (UIApplication *)application openURL: (NSURL *)url sourceApplication: (NSString *)sourceApplication annotation: (id)annotation
{
if ([GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]) {
return YES;
}else if([FBAppCall handleOpenURL:url sourceApplication:sourceApplication]){
return YES;
}
return NO;
}

For Swift users, (The idea from user2144179)
Import below frameworks
import Firebase
import GoogleSignIn
import FacebookCore // (FBSDKCore's alternative for swift)
and in your delegate methods
// when your target is under iOS 9.0
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
let isFBOpenUrl = SDKApplicationDelegate.shared.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
let isGoogleOpenUrl = GIDSignIn.sharedInstance().handle(url, sourceApplication: sourceApplication, annotation: annotation)
if isFBOpenUrl { return true }
if isGoogleOpenUrl { return true }
return false
}
or you can use another 'open url:' method if your target is 9.0+. SDKs include a method for it also.
Firebase Reference : https://firebase.google.com/docs/auth/ios/google-signin
Facebook Reference : https://developers.facebook.com/docs/swift/reference/classes/applicationdelegate.html

You can Try the following :
if ([[url absoluteString] rangeOfString:#"<Your Google Bundle ID>"].location == NSNotFound)
{
// Call FBAppCall's handleOpenURL:sourceApplication to handle Facebook app responses
BOOL wasHandled = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
// You can add your app-specific url handling code here if needed
return wasHandled;
}
else
{
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
return YES;
Call the above method in
(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
in your appDelegeate.m
Basically what this is going to do is examine the url prefix and then call the google+ method if url prefix is ur google+ bundle id , and if not , it'll call the fb method .
Hope this helps

The method "application:openURL:sourceApplication:annotation:" is deprecated from iOS9. so now you can use like.
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary *)options {
// For Google sign in SDK
if ([[GIDSignIn sharedInstance] handleURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]) {
return YES;
// For Facebook SDK
}else if ( [[FBSDKApplicationDelegate sharedInstance] application:app
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]){
return YES;
//For Google plus SDK
}else if ([GPPURLHandler handleURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]]){
return YES;
}
return NO;
}

The Swift version for iOS 9.0 and above of the accepted answer could be something like this:
import FacebookCore
[...]
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (GIDSignIn.sharedInstance().handle(url)) {
return true
} else if (ApplicationDelegate.shared.application(app, open: url, options: options)) {
return true
}
return false
}
Try to handle the URL with each SDK, the first one that recognizes it ends execution returning true. If no SDK could handle the URL, return false.
I hope it helps someone,
Xavi

This might be the easiest solution,
import GoogleSignIn
import FBSDKCoreKit
func application(_ application: UIApplication,
open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if GIDSignIn.sharedInstance().handle(url) {
return true
} else if ApplicationDelegate.shared.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation) {
return true
}
return false
}
#available(iOS 9.0, *)
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
if GIDSignIn.sharedInstance().handle(url) {
return true
} else if ApplicationDelegate.shared.application(app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation]
) {
return true
}
return false
}

You can try this for a Swift 4.2 version:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
{
if (url.scheme?.hasPrefix("fb"))! {
return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}
else
{
return GIDSignIn.sharedInstance().handle(url as URL?, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
annotation: options[UIApplicationOpenURLOptionsKey.annotation])
}
}

You can just let either Google SDK or Facebook SDK attempt handling and if the SDK does not handle then allow the other SDK to try:
#available(iOS 9.0, *)
private func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any])
-> Bool {
let handled: Bool = SDKApplicationDelegate.shared.application(application, open: url, options: options)
if handled { return handled }
return GIDSignIn.sharedInstance().handle(url,
sourceApplication:options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
annotation: [:])
}
//deprecated method iOS 8 and older
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
let handled: Bool = SDKApplicationDelegate.shared.application(application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
if handled { return handled }
return GIDSignIn.sharedInstance().handle(url,
sourceApplication: sourceApplication,
annotation: annotation)
}

You'll want to use [[UIApplication sharedApplication] canOpenURL:]

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
if( [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation])
{
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
else if([[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation])
{
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
return NO;
}

Related

Implementing Facebook Login IOS

I'm trying to follow the facebook developers website's instructions for implementing their login. Step 5 is telling me to add some code to my AppDelegate class, specifically AppDelegate.m (which I don't have, I only have AppDelegate.swift).
This is the code I'm supposed to add:
// AppDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
// Add any custom logic here.
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
// Add any custom logic here.
return handled;
}
If I try putting it into the AppDelegate.swift file I get all sorts of errors, and I'm not finding any good documentation out there to do this properly. How do I solve this?
That code in objective-c , you should use swift
import FBSDKCoreKit
import FBSDKLoginKit
func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication,open url: URL,options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
{
if #available(iOS 9.0, *) {
let sourceApplication: String? = options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url,sourceApplication: sourceApplication, annotation: nil)
}
return true
}
public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL!, sourceApplication: sourceApplication, annotation: annotation)
}

Google sign in issue in Swift

i have installed pod 'Google/SignIn' framework in my project. I have integrated client ID and all the stuffs provided by google Docs, the problem is when i hit google sign in button its takes me to google SignIn page in there i entering my username and password after i hit submit button the page its not redirect to my App its still in google page and its not returning any values from Google page
here my sample code :
#IBAction func socialAction(sender: AnyObject) {
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().clientID = "************.apps.googleusercontent.com"
GIDSignIn.sharedInstance().signIn()
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
withError error: NSError!) {
if (error == nil) {
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let name = user.profile.name
let email = user.profile.email
print("gmail==>\(email)")
// ...
} else {
print("\(error.localizedDescription)")
}
}
in AppDelegate:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
if #available(iOS 9.0, *) {
var options: [String: AnyObject] = [UIApplicationOpenURLOptionsSourceApplicationKey: sourceApplication!,
UIApplicationOpenURLOptionsAnnotationKey: annotation]
} else {
// Fallback on earlier versions
}
return GIDSignIn.sharedInstance().handleURL(url,
sourceApplication: sourceApplication,
annotation: annotation)
}
r u handling url in app delegate? and try this if you are not handling.
func application(application: UIApplication,
openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication!, annotation: annotation) || FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
Add the URL scheme. For more details
https://developers.google.com/+/mobile/ios/getting-started#step_3_add_a_url_type
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
if([[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:annotation])
{
return YES;
}
else if ([[GIDSignIn sharedInstance] handleURL:url sourceApplication:sourceApplication annotation:annotation])
{
return YES;
}
return NO;
}
this code is perfectly working in objective c.

Facebook SDK login never calls back my application on iOS 9

I've followed this guide to update my application to use Facebook SDK 4.6 to work properly when built with the iOS 9 SDK.
When I tap the login button now, a Safari view controller gets presented (shouldn't it redirect to the Facebook app?), but after accepting permission the Safari view controller is never dismissed. It loads a new blank page and sits there doing nothing. If I tap the Done button, the returned FBSDKLoginManagerLoginResult's isCancelled is true.
Is it normal that the SDK is choosing the Safari view controller over the Facebook app? And why am I not getting callbacks after login is complete?
Turns out that on iOS 9 when UIApplicationDelegate's application:openURL:options: is implemented, application:openURL:sourceApplication:annotation: will not get called.
So what I had to do is call FBSDKApplicationDelegate's application:openURL:sourceApplication:annotation: from UIApplicationDelegate's application:openURL:options:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
return [[FBSDKApplicationDelegate sharedInstance] application:app
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
}
For Swift this was working for me (add it in AppDelegate.swift):
#available(iOS 9.0, *)
func application(application: UIApplication,openURL url: NSURL, options: [String: AnyObject]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application,
openURL: url,
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String,
annotation: options [UIApplicationOpenURLOptionsAnnotationKey])
}
and
#available(iOS, introduced=8.0, deprecated=9.0)
func application(application: UIApplication,openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application,
openURL: url,
sourceApplication: sourceApplication!,
annotation: annotation)
}
In each case remember to add import FBSDKCoreKit with the other import statements.
Its basically what Google SignIn uses. If its still not working you need to set the delegates and your info.plist like it is specified in the FaceBook Docs. I hope this helps!
For Swift 3 & Facebook SDK 4.16.0:
Add the following code to AppDelegate.swift
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}
For those of you experiencing this same issue with iOS10 I added this:
#available(iOS 9.0, *)
func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}
This should work but as for now its just a workaround
I have just come across this issue, thanks #Hesham for the fix.
Here is the Swift3 fix:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
app,
open: url,
sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String,
annotation: options[UIApplicationOpenURLOptionsKey.annotation])
}
for xamarin users :
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
{
OnUrlProtocolDetected(url.ToString());
if (url.AbsoluteString.StartsWith("fb"))
{
return ApplicationDelegate.SharedInstance.OpenUrl(application, url, sourceApplication, annotation);
}
}
Did you follow these steps?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return [[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
];
}
I think you are missing the point where you got to call the applications delegate in App delegate.
The second method is vital coz it gives the callback to your application about the login did finish in safari by the user
I was using the old 3.24 version and on iOS 9 I was facing a similar problem.
Found that in appDelegate method - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
was
return [FBSession.activeSession handleOpenURL:url];
instead of
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
For total swift newbies like myself, the problem was an alternate implementation of the application() method:
Working version:
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
Non working version (Copied from somewhere )
func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
application,
open: url,
sourceApplication: sourceApplication,
annotation: annotation)
}
For anyone looking for Swift assistance on this very issue the following worked for me.
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: UIApplicationOpenURLOptionsSourceApplicationKey, annotation: UIApplicationOpenURLOptionsAnnotationKey)
}

Conflict between Facebook Sign In and Google Sign In - iOS

I've successfully deployed a Log In via Facebook in my app. I've then tried to add the possibility to log in via Google+ but I gave up after a few long nights of coding and a few posts from people much more advanced than I am concluding on the roadblocks existing at the moment example: How can I login to google-plus using google-plus-ios-sdk-1.7.1 sdk?.
I am now trying to implement a Google Sign In by following the seemingly easy instructions from the Google Developer site.
However the way this is explained by Google creates several conflicts with the set-up needed for running the Log In via Facebook.
I have tried to rewrite the Facebook code by using a Pod and installing it at the same time I install the Google Sign In but I was not able to make it work (still something hindering the authentication via Facebook).
Implement like this way.
- (BOOL) application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
if ([[url scheme] isEqualToString:FBTOKEN]) {
return [FBSession.activeSession handleOpenURL:url];
return [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
withSession:FBSession.activeSession];
}
else {
[GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
return YES;
}
I implemented this way for Google and Facebook
func application(application: UIApplication,
openURL url: NSURL,
sourceApplication: String?,
annotation: AnyObject) -> Bool {
let options: [String: AnyObject] = [UIApplicationOpenURLOptionsSourceApplicationKey: sourceApplication!,
UIApplicationOpenURLOptionsAnnotationKey: annotation]
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation) ||
GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String, annotation: nil)
}
Check whether you implement or not GPPURLHandler method inside
-(BOOL) application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
}
-
This worked for me with Google Sign In version 2.4.0 and Facebook ios SDK 4.10.0
1) Remove the method
func application(application: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool
from AppDelegate
2) Implement as following :
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
if url.scheme == "fbxxxxxxxxxxxx" {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
else {
let options: [String: AnyObject] = [UIApplicationOpenURLOptionsSourceApplicationKey: sourceApplication!,
UIApplicationOpenURLOptionsAnnotationKey: annotation]
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation) ||
GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String, annotation: nil)
}
}
The fb url scheme is taken from Url Schemes in Info.plist

Handling different URL Schemes in iOS (Facebook and Instagram)

I am not even sure how to define the problem but here it goes.
I have an application that uses Facebook SDK for user login. I followed the Facebook authorization tutorial. I am not 100% sure how it works but this part in my "AppDelegate.m" seems important.
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [FBSession.activeSession handleOpenURL:url];
}
So far so good. Now I want to implement a similar login for instagram so that the user can access their photos. I run this example without a problem (https://github.com/crino/instagram-ios-sdk). When I tried to import this into my project I got stuck. Because in instagram project there is also a function in the AppDelegate (IGAppDelegate)
-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
return [self.instagram handleOpenURL:url];
}
Now I cant use this function (since it is a duplicate of Facebook one)
Is there a way to combine these two function for facebook and instagram (maybe with an "if" for different URLs). Or am I lost
PS: I noticed that when I call my facebook login app the url is something like
fb4333597123414933://authorize/#access_token=BAAGKI2vHLxUBANbDegkrdoc4GJWUZC2clqLAzxz8IxEBZBdEyjrD2oTaGZA0g2AbSGWgvEhONKM6xJWzLCALGUBguqUpor6kXu9ZBewusNZCUe6BOXYvX&expires_in=5166254
in instagram it is like:
igfd725621c5e44198a5b8ad3f7a0ffa09://authorize#access_token=354172840.fd72562.bf6b3611632d4d00b6cef660ea9d9b6f
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSLog(#"url: %#", [url scheme]);
BOOL callBack;
// Facebook Call back checking.
if ([[url scheme] isEqualToString:#"facebook_url_schema"])
{
callBack = [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
}
// Instagram call back checking.
else if ([[url scheme] isEqualToString:#"instagram_url_schema"])
{
callBack = [self.instagram handleOpenURL:url];
}
return callBack;
}
Swift :-
Example for use both Google+ and Facebook in swift app, both of them require the OpenURL method in the appDelegate.
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?,
annotation: AnyObject?) -> Bool {
println("URL : \(url)")
if(url.scheme!.isEqual("fb1627825840806667")) {
println("Facebook url scheme")
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
} else {
println("Google+ url scheme")
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication, annotation: annotation)
}
}
For Swift 2.0
//MARK: FACEBOOK , GOOGLE CALLBACK URL METHOD
//google-Firebase signin - IOS 8
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool
{
let googleDidHandle = GIDSignIn.sharedInstance().handleURL(url, sourceApplication: sourceApplication!, annotation: annotation)
let facebookDidHandle = FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
return facebookDidHandle || googleDidHandle
}
//google-Firebase signin - IOS 9
#available(iOS 9.0, *)
func application(application: UIApplication,
openURL url: NSURL, options: [String: AnyObject]) -> Bool {
let facebookDidHandle = FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
let googleDidHandle = GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
return facebookDidHandle || googleDidHandle
}
I think I found
[url scheme] gives those specific URL schemes
Xcode - multiple URL Schemes

Resources