WhatsApp showing alert “This item cannot be shared. Please select a different item.” for iOS app.

天涯浪子 提交于 2019-12-24 01:44:37

问题


I am developing an iOS app. In that app I have on social sharing feature and that Social sharing feature uses deep linking for sharing the url. That url sharing is working fine fine for all the apps except WhatsApp . It shows an alert popup "This item cannot be shared. Please select a different item". Below is the my code please suggest the changes I can make to it can be send on WhatsApp too.

func actioncontroller(){

    let actionSheetController: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)

    let takePictureAction: UIAlertAction = UIAlertAction(title: "Social sharing", style: UIAlertActionStyle.Default)

        { 

          action -> Void in

            let text: String = self.cards[self.cardIndex].title!

            let img: UIImage = imageCache[self.cards[self.cardIndex].imageURL!]!

            let pid = self.cards[self.cardIndex].id

            var tf = UITextView.self

              var URL = NSURL(string:  "https://myish.app.link/vk3Vh1Fexw?postid=\(pid)")!

                var str = NSMutableAttributedString(string: "https://myish.app.link/vk3Vh1Fexw?postid=\(pid)")

                str.addAttribute(NSLinkAttributeName, value: URL, range: NSMakeRange(0, str.length))

                 let objectsToShare = [str]

           let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)

             self.presentViewController(activityVC, animated: true, completion: nil) 

}

来源:https://stackoverflow.com/questions/39423821/whatsapp-showing-alert-this-item-cannot-be-shared-please-select-a-different-it

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