嗨,这是我的代码,我已经实现了UIactivityViewCotroller,但是当我单击时,我看不到邮件和Facebook应用程序
@IBAction func activityView(_ sender: UIButton) {
let text = "This is some text that I want to share."
let textToShare = [ text ]
let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook, UIActivityType.mail ]
self.present(activityViewController, animated: true, completion: nil)
}
但我看不到那些应用
我该怎么办?
最佳答案
替换功能如下
@IBAction func activityView(_ sender: UIButton) {
let text = "This is some text that I want to share."
let textToShare = [ text ]
let activityViewController = UIActivityViewController(activityItems: textToShare, applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
activityViewController.excludedActivityTypes = [ UIActivityType.airDrop ]
self.present(activityViewController, animated: true, completion: nil)
}
活动控制器
excludedActivityTypes
表示您要排除那些要在activityController
中列出的共享选项关于ios - iOS:activityType在UIactivityViewController上不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44949706/