tivityType在UIactivityViewControl

tivityType在UIactivityViewControl

嗨,这是我的代码,我已经实现了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/

10-11 09:11