xcode 使用我的 iphone 应用程序在 facebook 的墙上写一条消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2831842/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:21:41  来源:igfitidea点击:

write a message on wall of facebook using my iphone application

iphonexcodefacebook

提问by V.V

I am making an iphone game , In that I want to upload score on face book. I am new to face book codes, I've got it's API from github.com. But I don't know how to write or post directly my message on wall of face book of log in account else how to share my score on facebook. I've done log in portion. Can any one help me????

我正在制作一个iphone游戏,我想在脸书上上传分数。我是面子书代码的新手,我从 github.com 获得了它的 API。但是我不知道如何在登录帐户的面子书墙上直接写或张贴我的消息,否则如何在Facebook上分享我的分数。我已经完成了登录部分。谁能帮我????

采纳答案by Brad The App Guy

Assuming the user has allready logged in and you have a vaild faceb0ok session, you could use something like this to get you started:

假设用户已经登录并且你有一个有效的 faceb0ok 会话,你可以使用这样的东西来让你开始:

- (void) post {
    postingDialog = [[[FBStreamDialog alloc] init] autorelease];
    postingDialog.delegate = self;
    postingDialog.userMessagePrompt = @"Prompt the User:";

    NSString *name = @"Name of thing"
    NSString *href = @"http://www.example.com"

    NSString *caption = @"This is a caption"
    NSString *description = @"This is a description";
    NSString *imageSource = @"http://example.com/1.png";
    NSString *imageHref = @"http://example.com/1.png";

    NSString *linkTitle = @"Link title";
    NSString *linkText = @"Text";
    NSString *linkHref = @"http://www.example.com/iphone";
    postingDialog.attachment = [NSString stringWithFormat:
                                @"{ \"name\":\"%@\","
                                "\"href\":\"%@\","
                                "\"caption\":\"%@\",\"description\":\"%@\","
                                "\"media\":[{\"type\":\"image\","
                                "\"src\":\"%@\","
                                "\"href\":\"%@\"}],"
                                "\"properties\":{\"%@\":{\"text\":\"%@\",\"href\":\"%@\"}}}", name, href, caption, description, imageSource, imageHref, linkTitle, linkText, linkHref];
    [postingDialog show];
}

回答by Jim

Please refer the facebook api development at http://wiki.developers.facebook.com/index.php/Facebook_iPhone_SDK

请参阅http://wiki.developers.facebook.com/index.php/Facebook_iPhone_SDK 上的 facebook api 开发

Sample application also given by facebook for iPhone.

facebook 也为 iPhone 提供了示例应用程序。

Thanks,
Jim.

谢谢,
吉姆。