iphone : FBConnect Auto post to user wall

2019-03-30 09:35发布

i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?

1条回答
神经病院院长
2楼-- · 2019-03-30 09:49

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

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

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/

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

查看更多
登录 后发表回答