UIActivityViewController Facebook sharing URL + IMAGE and URL + TEXT not working

蓝咒 提交于 2019-12-08 04:13:57

问题


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 ?


回答1:


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



来源:https://stackoverflow.com/questions/50486049/uiactivityviewcontroller-facebook-sharing-url-image-and-url-text-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!