iOS - 无法从Google个人资料中获取基本用户信息
问题描述:
我想从Google帐户中检索名称,电子邮件等基本信息。这里Get User information after successful authentication with Oauth2我找到了提示将属性“shouldFetchGoogleUserProfile”更改为YES,但无法访问。iOS - 无法从Google个人资料中获取基本用户信息
GTMOAuth2ViewControllerTouch *viewController;
viewController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope:scope
clientID:kMyClientID
clientSecret:kMyClientSecret
keychainItemName:kKeychainItemName
delegate:self
finishedSelector:@selector(viewController:finishedWithAuth:error:)];
// error - can't access property "shouldFetchGoogleUserProfile"
viewController.signIn.shouldFetchGoogleUserProfile = YES;
[[self navigationController] pushViewController: viewController
animated:YES];
我也不能登录之后
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (!error) {
// userProfile - not accessible
// NSDictionary *profile = viewController.signIn.userProfile;
} else {
NSLog(@"Failure %@", error);
}
}
答
我有同样的问题,得到的结果。将
#import "GTL/GTMOAuth2SignIn.h"
添加到桥接头,它是signIn的类。