简体   繁体   English

使用Facebook SDK for iOS发布故事时未上传图像

[英]Image not uploaded when publishing a story using Facebook SDK for iOS

I'm following the official FB tutorial for publishing stories using the share dialog: 我正在关注使用共享对话框发布故事的官方FB教程:

https://developers.facebook.com/docs/ios/open-graph#sharedialog https://developers.facebook.com/docs/ios/open-graph#sharedialog

I already configured my facebook app and I set up the correct capabilities on the action (just like is described on the tutorial). 我已经配置了我的Facebook应用程序,并在动作上设置了正确的功能(就像在教程中描述的那样)。 I double and triple checked every step. 每一步我都会检查两次和三次。

The story is published, but the image does not appear on the post. 故事已发布,但图片未显示在帖子上。 When the share dialog appears, the thumbnail of the image is shown, then I tap on "Post" and I can see the progress of the bar that indicates the uploading, but at the end I get a post without an image. 当共享对话框出现时,显示图像的缩略图,然后点击“发布”,我可以看到指示上传的栏的进度,但最后我得到一个没有图像的帖子。

I downloaded the tutorial app sources, compiled it and I got the same result ( https://github.com/fbsamples/ios-howtos/tree/master/FBOGSampleSD ). 我下载了教程应用程序源代码,编译它,我得到了相同的结果( https://github.com/fbsamples/ios-howtos/tree/master/FBOGSampleSD )。

Looks like this is probably related to this bug: https://developers.facebook.com/bugs/456750217796696/ 看起来这可能与此错误有关: https//developers.facebook.com/bugs/456750217796696/

It's been fixed but I don't think the update has been released yet. 它已被修复,但我认为更新尚未发布。

One thing you could do in the meantime is upload the image to Facebook's staging servers from your app before sending the action to the share dialog, but this would force you to get publish permissions from the user through your app, which admittedly isn't great but would at least get your images up there. 在此期间你可以做的一件事是在将动作发送到共享对话框之前将图像从你的应用程序上传到Facebook的登台服务器,但是这会迫使你通过你的应用程序获得用户的发布权限,这无疑是不是很好但至少会把你的照片放到那里。

[FBRequestConnection startForUploadStagingResourceWithImage:image completionHandler:^(FBRequestConnection* connection, id result, NSError* error) {
    if(!error)
    {
        [newImageInfo setObject: [result objectForKey:@"uri"] forKey: @"url"];
        [fbObject setObject: @[newImageInfo] forKey: @"image"];

        // Setup action with fbObject property, then send action to native Share Dialog
    }
    else
    {
        NSLog(@"[ERROR] Could Not Stage Image: %@", error.description);
    }
}];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM