我想从Google帐户中检索姓名,电子邮件等基本信息。 Get User information after successful authentication with Oauth2我已经找到了将“shouldFetchGoogleUserProfile”属性更改为“是”的提示,但我无法访问。
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);
}
}
答案 0 :(得分:0)
我有同样的问题。添加
#import "GTL/GTMOAuth2SignIn.h"
到桥接标题,这是signIn的类。