请不要标记已见过iOS11: UIActivityViewController not successfully sharing UIImage to 3rd party apps
的重复内容所以我尝试与UIActivityViewController
分享图片+网址。
但是,当点击Facebook时它只显示URL
,图像不显示
这是我的代码
@IBAction func btnShareTapped(_ sender: UIButton) {
if let image = self.imgBackground.image, let jpgImage = UIImageJPEGRepresentation(image, 0.8) {
let shareItems:Array = [jpgImage,URL(string: "https://www.facebook.com")] as [Any]
let activityViewController:UIActivityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivityType.print, UIActivityType.postToWeibo, UIActivityType.copyToPasteboard, UIActivityType.addToReadingList, UIActivityType.postToVimeo]
self.present(activityViewController, animated: true, completion: nil)
DispatchQueue.main.async {
self.present(activityViewController, animated: true, completion: nil);
}
}
}
如果我删除URL
,那么我就可以共享图片了
只有可见的网址
是否有与URL或任何文本共享图像的解决方法?
答案 0 :(得分:0)
当前无法同时共享图像和URL