Facebook对话框未从警报视图处理程序启动。 但facebook对话框从按钮启动OK。
启动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时,对话框成功打开。
请帮助解决问题。
答案 0 :(得分:1)
[self performSelectorOnMainThread:@selector(share_on_facebook)];应该做的伎俩