问题
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