我有這樣的一段代碼,我使用的顯示登錄對話框/發佈到用戶牆上作用:如果我連這個代碼Facebook的登錄對話框不會與UIAlertView中工作,但與UIButton的
_posting = YES;
// If we're not logged in, log in first...
if (![_session isConnected]) {
self.loginDialog = nil;
loginDialog = [[FBLoginDialog alloc] init];
[_loginDialog show];
}
// If we have a session and a name, post to the wall!
else if (_facebookName != nil) {
[self postToWall];
}
// Otherwise, we don't have a name yet, just wait for that to come through.
一個按鈕,它的工作原理。然而,當我把它放在下面的方法中:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
NSLog(@"No");
}
else
{
_posting = YES;
// If we're not logged in, log in first...
if (![_session isConnected]) {
self.loginDialog = nil;
_loginDialog = [[FBLoginDialog alloc] init];
[_loginDialog show];
}
// If we have a session and a name, post to the wall!
else if (_facebookName != nil) {
[self postToWall];
}
// Otherwise, we don't have a name yet, just wait for that to come through.
}
}
它不工作..
任何人都可以,爲什麼這可能是解釋一下嗎?當我說它不起作用時,我的意思是對話框在關閉之前非常簡短地顯示。該應用程序不會崩潰。
你是否設置了UIAlertview的deleagate? –
是的,我在頭文件中。 –