Objective c iOS中的Gmail登录
我想通过gmail登录我的应用程序。我正在使用这个代码,他们为我打开gmail。他们在病房后显示屏幕,不重定向我的应用程序。请帮助我在iOS中更新。在这个屏幕上有代码并写着复制这个代码并切换到我们的应用程序并粘贴在这里。或者有没有什么简单的方法来登录gmailObjective c iOS中的Gmail登录,objective-c,iphone,ios8,Objective C,Iphone,Ios8,我想通过gmail登录我的应用程序。我正在使用这个代码,他们为我打开gmail。他们在病房后显示屏幕,不重定向我的应用程序。请帮助我在iOS中更新。在这个屏幕上有代码并写着复制这个代码并切换到我们的应用程序并粘贴在这里。或者有没有什么简单的方法来登录gmail static NSString *const kKeychainItemName = @"OAuth2 Sample: Google+"; NSString *kMyClientID = @"7-s.apps.googleusercon
static NSString *const kKeychainItemName = @"OAuth2 Sample: Google+";
NSString *kMyClientID = @"7-s.apps.googleusercontent.com"; // pre-assigned by service
NSString *kMyClientSecret = @"qD-L"; // pre-assigned by service
NSString *scope = @"https://www.googleapis.com/auth/plus.me"; // scope for Google+ API
GTMOAuth2ViewControllerTouch *viewController;
viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope
clientID:kMyClientID
clientSecret:kMyClientSecret
keychainItemName:kKeychainItemName
delegate:self
finishedSelector:@selector(viewController:
finishedWithAuth:error:)] ;
[self presentViewController:viewController animated:YES completion:nil];
而不是最后一行:
[自呈现viewController:viewController动画:是完成:无]代码>
应该有下一个屏幕视图控制器的实例,例如,下一个屏幕是homeViewController,然后:
[自我呈现视图控制器:homeViewController动画:是完成:无]
首先使用GooglePlus.framework
进行身份验证。这很容易
您缺少回调
,这需要应用程序中的以下设置来处理
步骤1
将以下方法添加到AppDelegate.m
文件中
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
//Handle callback here write a code
}
第2步
在info.plist中设置回调
url
有关详细信息,请参阅屏幕截图。
成功验证后,它将重定向到您的应用程序