How to pass parameters to Facebook, fb://publish/?
From my iOS app, I want to open the Facebook application to make a post in the user wall. I want to give a predefined text to make the post, and I don't know how to add the text to the call.
NSString *post = [NSString stringWithFormat:@"fb://publish"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:post]];
How could I pa开发者_运维知识库ss the text parameters with the "fb://publish/" option?
From Safari, some HTML like this seems to be working:
<a href="fb://publish/?text=#text#">...</a>
It opens up the Facebook application's share dialog with the text predefined, which you have to edit before you can actually share it. You can also include URLs into the text; Facebook converts that to a simple link once posted, but it does not add the image or any other meta details defined on that URL, as usual.
Note this redirects to the old style publish screen,
not the one the Facebook application has been using since version 3.4.
First install the Facebook API and try this code...
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
FBAppID, @"130506840369385",
@"http://developers.facebook.com/docs/reference/dialogs/", @"link",
@"http://fbrell.com/f8.jpg", @"picture",
@"Facebook Dialogs", @"name",
@"sdsdds", @"caption",
@"asdasdasd", @"description",
@"hi goolwihdfkasnv", @"message",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
For posting status to facebook use this URL:fb://publish/profile/me?text=foo
精彩评论