我正在尝试通过以下
使用Facebook帐户进行身份验证- (IBAction)logInByFaceBook:(id)sender {
NSLog(@"appDelegate.session.isOpen = %@",appDelegate.session.isOpen == 0 ? @"NO" : @"YES");
FBSessionLoginBehavior behavior = FBSessionLoginBehaviorForcingWebView;
appDelegate.session = [[FBSession alloc] init];
[appDelegate.session openWithBehavior:behavior
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:[NSNumber numberWithBool:YES] forKey:@"didLogIn"];
data = [[SavedData alloc] initLogInInfo:dict];
[data saveLogInInfoToDisk];
if (session.isOpen) {
FBRequest *me = [FBRequest requestForMe];
NSLog(@"me is %@",[me description]);
[me startWithCompletionHandler: ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *my, NSError *error) {
NSLog(@"my is %@",[my description]);
}
];
}
[self dismissViewControllerAnimated:YES completion:nil];
}
];
}
但是,我无法恢复username
并且控制台正在显示
Error: HTTP status code: 400
my is (null)
通过查找此documentation,400表示Invalid email address
.....并且my
为空,因此我根本无法提取username
... ..
我不知道为什么会发生这种情况...我尝试使用相同的电子邮件地址和facebookSDK示例代码并且它正常运行...
现在迷路....有人可以指出我做错了什么或错过了什么。