0

这个问题经常在 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];

但它什么也不做。我究竟做错了什么?谁能纠正我?

4

2 回答 2

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];
于 2012-06-29T13:31:42.447 回答
0

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

正常的 facebook 界面也会时不时地发生这种情况。过去几天,我也注意到 Graph API 出现了奇怪的错误。

于 2012-06-28T12:37:56.627 回答