iphone:FBConnect自动发布到用户墙 [英] iphone : FBConnect Auto post to user wall
问题描述
我想从我的iphone应用程序自动发布到用户墙(没有发布跳过对话框)。我该怎么做?
i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?
推荐答案
应该在实现 FBSessionDelegate的类中调用以下内容
the following should be called in the class that implements FBSessionDelegate
and FBRequestDelegate
:
Facebook *_facebook = [[Facebook alloc] initWithAppId:kAppId];
NSArray *_permissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access",nil] retain];
[_facebook authorize:_permissions delegate:self];
这就是对fb post的调用(应该在同一个类中使用):
And that is the call for fb post (should be used in the same class):
NSString *message = @"This is the message I want to post";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message",
nil];
[_facebook requestWithMethodName:@"stream.publish"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
如果您想在其他用户的墙上发布消息,您应该在其中包含uid参数你的params字典。请参阅 http://developers.facebook.com/docs/reference/rest /stream.publish/
If you want to post a message on the wall of other user you should include "uid" parameter in your params dictionary. Please consult http://developers.facebook.com/docs/reference/rest/stream.publish/
PS iPhone Facebook connect SDK 示例代码中有所有必要的示例,请<强>不要害怕调查一下;)
P.S. There are all the necessary examples in the iPhone Facebook connect SDK sample code, so please do not afraid to investigate just a little bit ;)
这篇关于iphone:FBConnect自动发布到用户墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!