【发布时间】:2013-11-19 19:26:30
【问题描述】:
我想获取用户 youtube usedID。使用 youTubeService 成功登录后。在viewController:finishedWithAuth:error: userID 上返回 nil。
Code
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error
{
[viewController dismissViewControllerAnimated:YES completion:NULL];
if(error != nil){
NSLog(@"Authentication error: %@", error);
}
else {
// Authentication succeeded...
NSLog(@"%@",auth.accessToken);
NSLog(@"%@",auth.userID); //returns nil
}
}
请注意,我不是在询问 Google 电子邮件 ID,而是要获取 youtube 用户 ID。
【问题讨论】:
-
我已经看到了这个答案,我也尝试了 userinfo URL 来获取用户 ID,但实际上它返回了我不想要的谷歌用户 ID。 { "email": "XXX@gmail.com", "verified_email": true }
-
您是否在建议的副本中查看了此答案? stackoverflow.com/a/12696891/449161
标签: ios objective-c youtube-api