ios - 我想使用 FBWebDialogs 在没有 url 的情况下在 facebook 上共享应用程序包中的图像?

标签 ios facebook image

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/

相关文章:

ios - Facebook iOS SDK ExtendAccessToken无法正常工作-无法调用fbDidExtendToken

java - 使用 userID 获取 Facebook 的大头像

php - 使用 JQuery/CSS 或可能的 PHP/CSS 将数据转换为图像。 (评分系统)

ios - Firebase 动态链接无法在安装后继续存在

ios - 自动布局确定 subview 的大小

facebook - 使用 cordova 插件获取高质量的 facebook 个人资料图片

css - 部分图像表现为 div HTML CSS

python - 使用 Python 生成彩色图图像

ios - React Native 等同于适配 size classes?

iphone - iOS 第二语言本地化