iOS:Google Plus使用Facebook和Google,登录 [英] iOS: Using both Facebook and Google, Google Plus sign in

查看:140
本文介绍了iOS:Google Plus使用Facebook和Google,登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,

我正在尝试实现Facebook登录(这是正常工作),还有谷歌加登录在同一个视图。我正在从官方网站(Google)跟随指南,但Facebook按钮和Google plus按钮之间存在问题:

I'm trying to implement the Facebook login (which is working fine) and also the google plus login in the same view. I'm following the guides from the official site (Google) but there is an issue between the Facebook button and the google plus button:

Facebook告诉我将以下内容代码:

Facebook tells me to put the following code:

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{

    return [FBAppCall handleOpenURL:url
                  sourceApplication:sourceApplication];
}

Google还告诉我将以下内容:

And also Google tells me to put the following:

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

我不能拥有相同的名称相同的功能,我可以不要将一个内部集成在另一个内部。这就是为什么我需要你的帮助,因为我不知道如何处理这些指南之间的这个问题。

And I can't have the same functions with the same name and I can't integrate one inside the other. That's why I need your help because I don't know how to deal with this issue between these guidelines.

提前感谢。

推荐答案

这里你必须在返回之前检查[url scheme]。示例代码如下。

Here you will have to check [url scheme] before returning. Example code is below.

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 
{ 
    NSLog("%@", [url scheme]); 

    if([[url scheme] isEqualToString:FACEBOOK_SCHEME]) 
    {  

        return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];

    }
    else if([[url scheme] isEqualToString:GOOGLE_PLUS_SCHEME]) 
    {  

        return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation]; 

    }
}

希望它能解决您的问题。 。

Hope it will solve your problem..

这篇关于iOS:Google Plus使用Facebook和Google,登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆