xcode ios 插件 com.apple.share.Facebook.post 不显示提供的文本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29875123/
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 07:04:42  来源:igfitidea点击:

ios plugin com.apple.share.Facebook.post do not show provided text

iosxcodesharinguiactivityviewcontroller

提问by Alex

In my app I'm using the following code that allows to share an image with a text:

在我的应用程序中,我使用以下代码允许与文本共享图像:

- (IBAction)sharePressed:(id)sender {
    UIImage *postingImage = [UIImage imageWithContentsOfFile:self.filepath];
    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[@"Lorem ipsum", postingImage] applicationActivities:nil;
    [self presentViewController:activityViewController animated:YES completion:nil];
}

And when posting I can see image, but can't see text. Also text doesn't appear in FB.

发布时我可以看到图像,但看不到文字。文本也不会出现在 FB 中。

回答by Daniel

I'm afraid to tell you, you cannot post text to Facebook programatically. It's a new Facebook prohibition that forbids "pre-filled" Facebook sharing. That is why newer versions of iOS do not show your text, even tough it's correctly provided (and works on Twitter and in other sharing options).

我不敢告诉你,你不能以编程方式向 Facebook 发布文本。这是一项新的 Facebook 禁令,禁止“预先填充”的 Facebook 共享。这就是为什么较新版本的 iOS 不显示您的文本,即使它正确提供(并且适用于 Twitter 和其他共享选项)。

For more info please refer to https://developers.facebook.com/docs/apps/review/prefill)

有关更多信息,请参阅https://developers.facebook.com/docs/apps/review/prefill)

回答by djr

I first saw this when Facebook updated their app on April 24th. Plain text sharing to Facebook isn't working as long as the Facebook app is installed. After you delete it, it's available again.

我第一次看到这个是在 Facebook 4 月 24 日更新他们的应用程序时。只要安装了 Facebook 应用程序,就无法与 Facebook 共享纯文本。删除后,它再次可用。

If you try to share a URL or an image together with the plain text, you will see Facebook as an option but the text field will be blank. The image or URL will attach without a problem.

如果您尝试与纯文本一起共享 URL 或图像,您将看到 Facebook 作为一个选项,但文本字段将为空白。图像或 URL 将毫无问题地附加。

I posted a sample project that reproduces this problem on github:

我在github上发布了一个重现这个问题的示例项目:

https://github.com/djr/UIActivityViewController-Facebook

https://github.com/djr/UIActivityViewController-Facebook

This is not an answer, but it's pretty clear that the problem is caused by the Facebook app.

这不是答案,但很明显问题是由 Facebook 应用程序引起的。