iphone : FBConnect Auto post to user wall

霸气de小男生 提交于 2019-12-05 01:19:03

问题


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:


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



来源:https://stackoverflow.com/questions/2744078/iphone-fbconnect-auto-post-to-user-wall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!