Ios 为什么用auth完成:方法没有';你不打电话吗?
我在我的示例应用程序上完成了google集成,而我正试图在我的项目中实现finishedWithAuth方法没有调用 0.0进入google+登录屏幕 1.我创建了Oauth客户端密钥生成 2.添加了gppsigninbutton 3.1在appdelegate.m文件中Ios 为什么用auth完成:方法没有';你不打电话吗?,ios,objective-c,google-plus,Ios,Objective C,Google Plus,我在我的示例应用程序上完成了google集成,而我正试图在我的项目中实现finishedWithAuth方法没有调用 0.0进入google+登录屏幕 1.我创建了Oauth客户端密钥生成 2.添加了gppsigninbutton 3.1在appdelegate.m文件中 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSStrin
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
if([FBSDKApplicationDelegate sharedInstance])
{
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
else
{
NSLog(@"entering");
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
}
实施
您似乎同时使用了
Facebook
和Google+
登录。因此,将-(BOOL)应用程序:(UIApplication*)应用程序openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication注释:(id)注释更改为:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
NSString *stringURL = [ url absoluteString];
if([stringURL containsString:@"fb"])
{
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
else
{
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
}
另外,使用Google登录的代码应该如下所示。问题在于您的登录范围
-(IBAction)loginWithGooglePressed:(id)sender
{
///
signIn = [GPPSignIn sharedInstance];
signIn.clientID = kClientId;
//signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserEmail = YES; // Uncomment to get the user's email
signIn.scopes= [NSArray arrayWithObjects:kGTLAuthScopePlusUserinfoEmail, nil];
// Optional: declare signIn.actions, see "app activities"
signIn.delegate = self;
[signIn trySilentAuthentication];
}
对我来说很好:
添加更多的代码…您需要哪一个代码区域,兄弟@安布。Karthik@Anbu.Karthik兄弟,有什么问题吗clientID@Anbu.Karthikbro根据你的建议,我添加了我正在访问的图片..意味着你的代码有效,只有回调无效。你可以从info.plist
添加有问题的URL方案的屏幕截图吗?bro我的上述代码在我的示例项目中工作,当我试图在我的项目中实现它的时候,它并没有要求做什么。。。。?
-(IBAction)loginWithGooglePressed:(id)sender
{
///
signIn = [GPPSignIn sharedInstance];
signIn.clientID = kClientId;
//signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserEmail = YES; // Uncomment to get the user's email
signIn.scopes= [NSArray arrayWithObjects:kGTLAuthScopePlusUserinfoEmail, nil];
// Optional: declare signIn.actions, see "app activities"
signIn.delegate = self;
[signIn trySilentAuthentication];
}