iOS:如何在社交网络上分享文字和图片? [英] iOS: How to share text and image on social networks?

查看:33
本文介绍了iOS:如何在社交网络上分享文字和图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我做错了,你能告诉我吗?

Please, can you tell me if I'm doing mistakes?

NSString *sharedMsg=[NSString stringWithFormat:@"Hello world"];
UIImage* sharedImg=[UIImage imageNamed:@"image"];
NSArray* sharedObjects=[NSArray arrayWithObjects:sharedMsg, sharedImg, nil];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] 
              initWithActivityItems:sharedObjects applicationActivities:nil];
activityViewController.popoverPresentationController.sourceView = self.view;
[self presentViewController:activityViewController animated:YES completion:nil];

在运行时,当我选择 Facebook 的图标时,文本丢失,图像正确显示.
我的 xcode 是 6.3.1,在 iPad 上测试过.

At runtime when I select the icon of Facebook the text is missing, the image is correctly displayed.
My xcode is 6.3.1, tested on iPad.

推荐答案

似乎 Facebook 应用程序的最新更新已将内置的 Facebook 共享活动替换为忽略状态文本的活动 - 如果您从您的设备将使用您拥有的代码显示文本.如果您安装了 Facebook 应用程序,您将获得图片、网址,但不会获得文本

It seems that a recent update to the Facebook application has replaced the in-built Facebook share activity with one that ignores status text - If you remove the Facebook app from your device the text will be displayed using the code you have. If you have the Facebook app installed you get images, URLs but not the text

Facebook 的政策不允许您预先填充状态消息并要求用户生成所有内容 - 虽然我理解这背后的意图,但我个人认为在许多情况下这有点愚蠢 - 例如在我的游戏中我想预先填充用户的分数,但现在我不能,所以用户会看到一个空对话框.我可能会简单地删除 Facebook 共享选项,因为现在没有人会使用它.

Facebook's policies don't allow you to pre-populate status messages and require all content to be user generated - while I understand the intention behind this, I personally think it is kind of stupid in many cases - For example in my game I want to pre-populate the user's score, but now I can't, so the user is presented with an empty dialog box. I will probably simply remove the Facebook sharing option as no-one will ever use it now.

来自 Facebook 的此回应证实该行为是有意为之

This response from Facebook confirms that the behaviour is by design

这篇关于iOS:如何在社交网络上分享文字和图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆