简体   繁体   English

此代码将如何使用Facebook Connect将图像发布到墙上?

[英]How will this code publish an image to a wall using Facebook Connect?

I would like to know what this code does exactly. 我想知道这段代码的确切作用。

- (void)dialogDidSucceed:(FBDialog*)dialog { 
//[self doSomethingExciting];
FBStreamDialog *dialog2 = [[[FBStreamDialog alloc] init] autorelease]; dialog.delegate = self;
dialog2.userMessagePrompt = @"Example prompt";
dialog2.attachment = @"{\"name\":\"Facebook iPhone SDK\","
"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\"," 
"\"caption\":\"Caption\",\"description\":\"Description\","
"\"media\":[{\"type\":\"image\"," 
"\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\"," 
"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],"
"\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}";
// replace this with a friend's UID
// dialog.targetId = @"999999"; 
[dialog2 show];

} }

When I run it it asks me if I want to publish on my and my friends walls, but Im not sure how this will look on the walls. 当我运行它时,它会问我是否要在我和我的朋友的墙上发布,但是我不确定这在墙上会是什么样。 Also does it publish to the users walls and then show up in their friends incoming stream, like "most recent" or does it actually post on every friends wall? 它还会发布到用户墙上,然后显示在他们的朋友输入流中,例如“最新”,还是实际上张贴在每个朋友墙上?

Thanks 谢谢

Yes. 是。 You are posting an image to their stream. 您正在将图像发布到他们的流。

Attachment is an escaped sequence of JSON that Facebook will pick up on and attach an image (and it looks like a link as well). 附件是JSON的转义序列,Facebook会在其上拾取并附加图像(它看起来也像一个链接)。

What the user will see is the image/link preconfigured as a wall post, and they will have a text box to enter their own text referred so as User Message Prompt. 用户将看到的是预先配置为墙贴的图像/链接,他们将有一个文本框可输入自己的文本,称为“用户消息提示”。

Whether or not it shows up on friends streams depends on their settings, but ultimately, this is a news stream post, and thus has the potential to appear on their home page. 它是否显示在朋友流上取决于他们的设置,但最终,这是一条新闻流帖子,因此有可能出现在其主页上。

An other answer already explained what the code does. 另一个答案已经解释了代码的作用。

This is just a tip: Create three fake FaceBook accounts, and connect them together. 这只是一个提示:创建三个假FaceBook帐户,然后将它们连接在一起。 Then use them to do your testings. 然后使用它们进行测试。 So you will know exactly what happens, and do all the tests you need during development without loosing all your friends. 因此,您将确切知道会发生什么,并在开发过程中进行所有需要的测试,而不会失去所有朋友。

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

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