0
未從警報視圖處理程序啓動Facebook對話框。 但Facebook對話框從按鈕啓動確定。iPhone:無法從警報視圖啓動Facebook對話框
推出的Facebook對話的代碼是繼
- (void) share_on_facebook
{
_facebook = [[Facebook alloc] initWithAppId:kAppId];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"a long run", @"name",
@"The Facebook Running app", @"caption",
@"it is fun", @"description",
@"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
[_facebook dialog:@"feed" andParams:params andDelegate:self];
}
警報視圖的處理程序是按鈕點擊
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
[self share_on_facebook];
}
未啓動Facebook的對話框,但是當我打電話從普通的按鈕單擊處理程序share_on_facebook該對話框將成功打開。
請幫忙解決問題。
仍然沒有成功:(你能提供一些完整的代碼片段...? – deimus
嗯,我們已經想通了謝謝! – deimus
你能分享答案? – Mugunth