我的主屏幕上有一个 facebook 登录按钮。我可以根据需要使用该按钮多次登录和注销,而且它总是可以正常工作。然后在另一层,有一个按钮可以在 Facebook 上分享我的分数。有两种情况: Case1 是如果我登录了,它会分享分数。Case2是如果我没有登录,它会告诉用户我需要登录。这是我的分享按钮代码:
[FBRequestConnection startForPostStatusUpdate:message
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
UIAlertView *alert;
NSLog(@"%@",error);
if (!error)
{
alert = [[UIAlertView alloc] initWithTitle:@"You score" message:@"has been published" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
}
else{
alert = [[UIAlertView alloc] initWithTitle:@"Login Failed" message:@"Please login to your facebook account" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
}
[alert show];
[alert release];
所有这一切都按预期工作,但是如果我从上面描述的案例 2 返回到出现 facebook 登录按钮的主屏幕,那么如果我单击登录按钮,则会打开 facebook 权限页面。当我单击确定时,应用程序崩溃。它转到委托方法loginViewShowingLoggedInUser
,但在转到委托方法之前loginViewFetchedUserInfo
,它崩溃了。可能是什么原因?