本文介绍了UIActivityViewController Facebook共享URL + IMAGE和URL + TEXT不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请不要将已经看到的重复标记为

是否有任何变通方法来与URL或任何文本共享图像?

解决方案

当前无法同时共享图像和URL

Please don't mark duplicate already seen iOS11: UIActivityViewController not successfully sharing UIImage to 3rd party apps

So I am trying to share Image + URL with UIActivityViewController .However when tap on facebook it only show URL, Image is not showingup

Here is my code

@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);
        }
    }
}

If I remove URL then I can able to share image,

Only URL Visible for sharing

Is there any workaround to share Image with URL or any text ?

解决方案

it's impossible to share images and URL at the same time currently

这篇关于UIActivityViewController Facebook共享URL + IMAGE和URL + TEXT不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 07:48