如何使用iPhone Graph API将故事发布到Facebook Wall?

时间:2011-08-12 07:45:13

标签: iphone objective-c xcode facebook-graph-api

我想在用户墙上发布一些内容。我使用下面的代码在用户墙上发布,但是一旦我登录,我就会看到一个空白的屏幕。有人可以帮忙吗?

(void) fbDidLogin {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];

NSString *kAppId;
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               kAppId, @"109133762519851",
                               @"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];   

3 个答案:

答案 0 :(得分:1)

请参阅Facebook graph api

中的PostFeed方法

答案 1 :(得分:1)

看看你是否可以利用这个:

https://github.com/facebook/facebook-ios-sdk

答案 2 :(得分:1)

你试过

吗?
 [facebook dialog: @"stream.publish" andParams: params andDelegate:self];

http://thinkdiff.net/facebook/how-to-develop-facebook-application-for-iphone/