不能从我的应用程序发布在朋友的墙上

时间:2012-06-28 12:35:41

标签: ios facebook

这个问题经常被问到stackoverflow.com,但没有一个答案对我有用。我需要做的是在我的应用程序内张贴用户朋友的墙上。我已将stream_publish包含在权限列表中,因此它必须正常工作,但事实并非如此。

我已经尝试过的是:

NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:@"Some text" forKey:@"user_message_prompt"];
[params setObject:@"another text" forKey:@"action_links"];
[params setObject:@"Yet another text" forKey:@"attachment"];
[params setObject:@"1234567890" forKey:@"target_id"];

[facebook dialog: @"stream.publish"
       andParams: params
     andDelegate: self];

但是当弹出对话框窗口时,它会告诉我“MyAppName出错。请稍后再试。”

我也试过

[facebook requestWithGraphPath:@"[1234567890]/feed" andParams:[NSMutableDictionary dictionaryWithObject:@"test wall post" forKey:@"message"] andHttpMethod:@"POST" andDelegate:self];

但它什么也没做。我究竟做错了什么?任何人都能纠正我吗?

2 个答案:

答案 0 :(得分:0)

这个错误让我觉得这只是一个临时的Facebook事情。

它也会偶尔发生在普通的facebook界面上。最近几天我也注意到了图谱API的奇怪错误。

答案 1 :(得分:0)

这就是我解决它的方式。问题是操作链接的参数不正确。

SBJSON *jsonWriter = [[SBJSON new] autorelease];

NSMutableDictionary* params = [NSMutableDictionary dictionary];
[params setObject:FB_APP_ID forKey:@"api_key"];
[params setObject:@"User message prompt" forKey:@"user_message_prompt"];

[params setObject:@"531370682" forKey:@"target_id"];

NSArray *actionLnks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:@"Action Links", @"text", @"http://football.ua",@"href", nil], nil];
NSString *actionStr = [jsonWriter stringWithObject:actionLnks];

NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"Attachment name", @"name",
                            @"Attachment caption", @"caption",
                            @"Attachment description", @"description",
                            @"http://football.ua", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];

[params setObject:actionStr forKey:@"action_links"];
[params setObject:attachmentStr forKey:@"attachment"];

[facebook dialog: @"stream.publish"
       andParams: params
     andDelegate: self];