Handling openURL: with Facebook and Google

后端 未结 10 1679
长情又很酷
长情又很酷 2021-01-01 09:39

user in my app can login using 2 services : Facebook or Google

everything works fine, however, in the :

- (BOOL)application:(UIApplication *)applicat         


        
10条回答
  •  梦谈多话
    2021-01-01 10:18

    You can Try the following :

    if ([[url absoluteString] rangeOfString:@""].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

提交回复
热议问题