NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"The mechanic has done a fine job improving my vehicle…", @"name", @"Click below to download this awesome app for FREE and challenge me", @"description",iTunesLink, @"link", img, @"picture", nil];
//step 2
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
//nslog(@"Error publishing story.");
} else
{
if (result == FBWebDialogResultDialogNotCompleted)
{
// User clicked the "x" icon
//nslog(@"User canceled story publishing.");
}
else
{
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"])
{
// User clicked the Cancel button
//nslog(@"User canceled story publishing.");
} else
{
// User clicked the Share button
//NSString *msg = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
// Show the result in an alert
isSharedButtonTapped = YES;
self.btnFacebookShare.userInteractionEnabled = NO;
[[[UIAlertView alloc] initWithTitle:@"Success!" message:@"Successfully shared to Facebook" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil] show];
}
}
}
}];
如果我将图片作为“URL”提供,则可以正常发布。否则它的抛出错误。我想发布应用程序包中的图像。有人可以告诉我我在哪里编码错误吗?
最佳答案
`NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Sharing Tutorial", @"name",
@"Build great social apps and get more installs.", @"caption",
@"Allow your users to share stories on Facebook from your app using the iOS SDK.", @"description",
@"https://developers.facebook.com/docs/ios/share/", @"link",
@"http://i.imgur.com/g3Qc1HN.png", @"picture",
nil];`
[FBDialogs presentShareDialogWithPhotoParams:params
clientState:nil
handler:^(FBAppCall *call,
NSDictionary *results,
NSError *error) {
if (error) {
} else {
//分享成功对话框
}
}];
关于ios - 我想使用 FBWebDialogs 在没有 url 的情况下在 facebook 上共享应用程序包中的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28169352/