在iphone上使用facebook sdk发布链接

在iphone上使用facebook sdk发布链接,iphone,objective-c,facebook,Iphone,Objective C,Facebook,我有演示facebook应用程序,没有任何修改,代码如下: SBJSON *jsonWriter = [[SBJSON new] autorelease]; NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: @"Always Running",@"text",@"http://it

我有演示facebook应用程序,没有任何修改,代码如下:

  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];
然而,这并没有发布链接,事实上它只发布用户输入的正常状态

如何使用最新版本的Facebook(graph api)在iPhone上使用Facebook SDK发布链接


我找不到任何关于如何使用facebook sdk发布iphone应用程序链接的信息。

这怎么可能?创建NSArray但将其放入NSDictionary:

NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                               @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];
//编辑2:如前所述,应该是
NSArray*actionLinks=…

[_facebook dialog:@"feed"
      andParams:params
    andDelegate:self];
问题是facebook在web上更新了API,但没有更新SDK,因此,虽然API更新后,
@“feed”
是对话框的正确名称,但代码中仍然使用旧名称
stream.publish
。因此,要使参数发挥作用并成为消息的一部分,您必须使用:

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


另请参见iPortable对facebook另一个错误的回答。

LOL@facebook,这是facebook的示例代码,甚至不是我的。谢谢,我找到了实际的问题,我会把它放在一个答案中,但是你得到了赏金。刚刚尝试了你的答案,实际上这是第一个错误的NSDictionary,所以保留=后面的数组,并将第一个单词改为NSArray。你不可能知道,但还是感谢你发现了这一点。