当我在调试模式下在 iPhone 模拟器中进行身份验证时,if
运行下面代码中的第一条语句。但是,当我在安装了 Evernote 客户端的 iPhone 上进行调试时,该if
语句不会出现评估。取而代之的是,Evernote iOS 应用程序会出现片刻,然后直接返回到此 ViewController,而不会在 if 下设置任何断点,也不会触发 segue。
有任何想法吗?
[session authenticateWithViewController:self completionHandler:^(NSError *error) {
if (error || !session.isAuthenticated){
if (error) {
NSLog(@"Error authenticating with Evernote Cloud API: %@", error);
}
if (!session.isAuthenticated) {
NSLog(@"Session not authenticated");
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Could not authenticate"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
} else {
// We're authenticated!
EvernoteUserStore *userStore = [EvernoteUserStore userStore];
[userStore getUserWithSuccess:^(EDAMUser *user) {
// success
NSLog(@"Authenticated as %@", [user username]);
[self performSegueWithIdentifier:@"introductionStepOne" sender:self];
} failure:^(NSError *error) {
// failure
NSLog(@"Error getting user: %@", error);
} ];
}
}];