答案 0 :(得分:0)
尝试这样的事情:
private func shareWhatYouWant() {
//pop invite view
var textToShare = "Your message"
if let myWebsite = NSURL(string: "Yourwebsite.com") {
let objectsToShare = [textToShare, myWebsite] as [Any]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
//New Excluded Activities Code
activityVC.completionWithItemsHandler = {
activity, sucess, items, error in
if !sucess {
print("cancelled")
return
}
if activity == UIActivityType.postToFacebook {
print("share on facebook")
}
if activity == UIActivityType.postToTwitter {
print("share on twitter")
}
if activity == UIActivityType.message {
print("share on message")
}
if activity == UIActivityType.addToReadingList {
print("air drop select")
}
}
activityVC.popoverPresentationController?.sourceView = sender as? UIView
self.present(activityVC, animated: true, completion: nil)
}
}