在iphone上使用facebook sdk发布链接 [英] post link using facebook sdk on iphone

查看:112
本文介绍了在iphone上使用facebook sdk发布链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  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,
@Facebook Running app,@caption,
@ 这很有趣,@description,
@http://itsti.me/,@href,nil];
NSString * attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@在Facebook上分享,@user_message_prompt,
actionLinksStr,@action_links,
attachmentStr,@附件
nil];


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

然而,这不会发布链接,它只是发布用户输入的正常状态。



如何在iPhone上使用Facebook SDK发布链接,使用最新版本的Facebook(图形API)



我没有找到任何关于如何使用Facebook sdk从iphone应用程序发布链接的任何地方。

解决方案

  [_ facebook dialog:@feed
andParams:params
andDelegate:self];

问题是Facebook更新了网络上的API,而不是SDK,所以在<$在API更新之后,c $ c> @feed是对话框的正确名称,旧名称 stream.publish 仍然用于代码。因此,要让参数工作,实际上是您必须使用的消息的一部分:

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

来源here



另请参阅iPortable的回答另一个错误的Facebook。


I have the demo facebook app and without any modification this is the code:

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

This however doesn't post a link, it fact it only posts a normal status which the user enters.

How do I post a link using the Facebook SDK on an iPhone, using the newest version of the facebook (the graph api?)

I can't find anywhere on how to post a link from an iphone app using the facebook sdk.

解决方案

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

The problem is that facebook updated the API on the web, but not the SDK, so while @"feed" is the correct name for the dialog after the API update, the old name stream.publish is still used in the code. Therefore to get the params to work and actually be part of the message you have to use:

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

Source here

Also see iPortable's answer for another mistake by facebook.

这篇关于在iphone上使用facebook sdk发布链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆