i want to auto post to a user wall from my iphone applications ( without that "publish" "skip" dialog box ). how i can do that ?
Asked
Active
Viewed 3,734 times
4
-
Please look through the edited answer – knuku Mar 17 '11 at 14:29
1 Answers
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 ;)

knuku
- 6,082
- 1
- 35
- 43
-
hey dude, i tried to run this code but i only get an exception: +[FBRequest request]: unrecognized selector sent to class 0x14994 --> do you have an idea? – nimrod Mar 02 '11 at 22:13
-
Please look carefully through the answer. I've mentioned that you have to resume or create `FBSession`, did you do that? See my edits: I've empahsized this frase and added the code that creates `FBSession` so please review your code. – knuku Mar 15 '11 at 06:38
-
-
1Enjoy the correct answer. This is just a code from Facebook DemoApp + a little bit roaming around http://developers.facebook.com/docs/reference/rest/#publishing-methods to find `stream.publish` description. I've mentioned both of them before. And now I'm confused, was my previous answer really worth of downvoting? Or it is just frustration on the grounds of laziness? ;) – knuku Mar 17 '11 at 14:26
-
@NR4TR Good job! I came back to this to edit your answer, but you did it anyway! – CVertex Mar 18 '11 at 10:20
-
@NR4TR: I am also getting unrecognized selector send to class" exception. I have posted question with full code at http://stackoverflow.com/questions/9002229/iphone-unrecognized-selector-sent-to-instance-exception-while-publishing-stream Could you please check what's wrong there? I have taken care everything! – Paresh Masani Jan 25 '12 at 11:57