繁体   English   中英

Facebook iOS SDK对话框参数

[英]Facebook iOS SDK Dialog parameters

这可能是一个n00b问题,但是……我在iPad应用程序中使用Facebook SDK时遇到了一个问题:当我使用[facebook dialog:@"feed" andDelegate:self];显示对话框时[facebook dialog:@"feed" andDelegate:self]; 我看不到可以更改标题,内容或要共享内容的URL的任何方法。

在其演示应用程序中,Facebook具有以下代码:

- (IBAction)publishStream:(id)sender {

  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];

}

但是,当我按下publishStream按钮时,这些字符串都不会显示在对话框中! :S

有什么我做不对的事情吗? 我在该演示应用程序中所做的更改只是Facebook kAppId和URL Scheme。

我意识到这已经得到了答案,但是我发现这是正确的答案。 它遵循FB在这里的功能 图像和/或链接实际上显示在对话框中。 stream.publish并没有对我进行更改。 此外, 对话框页面还说stream.publish是旧的。

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"http://developers.facebook.com/docs/reference/dialogs/", @"link",
                               @"http://fbrell.com/f8.jpg", @"picture",
                               @"Facebook Dialogs", @"name",
                               @"Reference Documentation", @"caption",
                               @"Dialogs provide a simple, consistent interface for apps to interact with users.", @"description",
                               @"Facebook Dialogs are so easy!",  @"message",
                               nil];


[_facebook dialog:@"feed"
        andParams:params
      andDelegate:self];

我有同样的问题。 这是我找到的解决方案:以这种方式更改代码:

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

使用stream.publish而不是feed。

嗯..我还没有使用示例应用程序,但是我想如果您想在墙上贴东西,则需要进行POST。 在此处查看该问题和我的答案: 使用最新的FBConnect SDK将发布到iPhone的用户的Facebook墙上

总结一下,这是我使用的方法:

- (void)requestWithGraphPath:(NSString *)graphPath
                   andParams:(NSMutableDictionary *)params
               andHttpMethod:(NSString *)httpMethod
                 andDelegate:(id <FBRequestDelegate>)delegate;

像这样:

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

[user_id]的墙上发表评论。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM