xcode Facebook 分享照片:给我(facebookErrDomain 错误 368。)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11931246/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:13:34  来源:igfitidea点击:

Facebook Share Photo: giving me (facebookErrDomain error 368.)

iphoneiosxcodefacebookfbconnect

提问by thesecondlastjedi

When I try to share a screenshot of my iOS app on Facebook I get the following response :

当我尝试在 Facebook 上分享我的 iOS 应用的屏幕截图时,我收到以下回复:

FB error: The operation couldn???t be completed. (facebookErrDomain error 368.)

FB 错误:操作无法完成。(facebookErrDomain 错误 368。)

Post Photo Code

邮政照片代码

NSMutableDictionary *params = [NSMutableDictionary
                               dictionaryWithObjectsAndKeys:fbImage, @"picture", fbContent, @"caption"
                               ,nil];

[_facebook requestWithMethodName:@"photos.upload" andParams:params
                   andHttpMethod:@"POST" andDelegate:self];

I take the screenshot using

我使用截图

UIGraphicsBeginImageContext(self.view.frame.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

The thing is, I am able to post the screenshot in my other app using the exact same code. So that would mean it is not solely because of fb server issues? Is there something I might be missing?

问题是,我可以使用完全相同的代码在我的其他应用程序中发布屏幕截图。那么这是否意味着它不仅仅是因为 fb 服务器问题?有什么我可能会遗漏的吗?

EditI am also using FBConnect in the same project for sharing text using:

编辑我也在同一个项目中使用 FBConnect 来共享文本:

  [_facebook dialog:@"feed" andParams:params andDelegate:self];

with params as:

参数为:

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                           url, @"link",
                           name, @"name",
                           caption, @"caption",
                           desc, @"description",
                           nil];

And it works absolutely fine.

它工作得很好。

回答by thesecondlastjedi

Thank you for the comments. I found out the cause of my error. After I printed a log of the error localized description:

谢谢你的意见。我发现了我的错误的原因。在我打印了错误本地化描述的日志后:

- (void)request:(FBRequest *)request didFailWithError:(NSError *)error 
{
    NSLog(@"FB error: %@", [error localizedDescription]);
}

it mentioned facebookErrDomain error 368 and after printing the whole description:

它提到了 facebookErrDomain 错误 368 并在打印了整个描述之后:

    NSLog(@"FB error: %@", [error description]);

it was written that Facebook doesn't allow spam links.

据说 Facebook 不允许垃圾邮件链接。

Turns out I had misspelled the link in the caption for the photo post. After rectifying it worked smoothly.

原来我拼错了照片帖子标题中的链接。整改后运行顺利。

So if you get facebookErrDomain error 368.check the data you are sending in Params. If it contains a link you haven't created yet or any other data that can be thought to be as spam, delete it or comment it out and the error should disappear.

因此,如果您收到facebookErrDomain 错误 368。请检查您在 Params 中发送的数据。如果它包含您尚未创建的链接或任何其他可被视为垃圾邮件的数据,请将其删除或将其注释掉,错误就会消失。