I have used the Graph API, and have successfully logged in to Facebook and gotten the friends list.
Now I need to post a message on the wall. How?
I have used the Graph API, and have successfully logged in to Facebook and gotten the friends list.
Now I need to post a message on the wall. How?
use the url for posting on wall and use this method for post on wall
- (void)postToWall
{
FBStreamDialog *dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Facebook Connect for iPhone\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\",\"caption\":\"Caption\",\"description\":\"Description\",\"media\":[{\"type\":\"image\",\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}"];
[dialog show];
}
You can also learn how to publish wall and other essential practice for iOS Facebook Development from the demo that official published by facebook "Hackbook for iOS"
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:1];
[variables setObject:@"this is a test message: postMeFeedButtonPressed" forKey:@"message"];
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"yourFriendFbID/feed" withPostVars:variables];
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];
[parser release];
if you want to post to your wall thought your FB app without showing a dialog you could do it like this
NSString *message = @"some text";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:message, @"message",nil];
[fb requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self]; //fb here is the FaceBook instance.
and for sure you will do that after the user login and authorized the permissions .