我想从UIActivityViewController选项中禁用Messenger。我知道有excludedActivityTypes属性,我可以从显示中排除一些活动。它工作正常,我禁用了我想要的东西。但我的共享选项中仍然有Messenger,这也是我想要排除的。我不知道该怎么做。我可以通过使用rawValue再设置一个UIActivityType来禁用它吗?什么是Messenger Share的rawValue?谢谢你的帮助
vc.excludedActivityTypes = [
UIActivityType.postToWeibo,
UIActivityType.print,
UIActivityType.copyToPasteboard,
UIActivityType.addToReadingList,
UIActivityType.assignToContact,
UIActivityType.print,
UIActivityType.message,
UIActivityType.mail,
UIActivityType.airDrop,
UIActivityType.postToFlickr,
UIActivityType.postToVimeo,
UIActivityType.postToFacebook,
UIActivityType.postToTwitter,
UIActivityType.postToTencentWeibo,
UIActivityType.airDrop,
UIActivityType.assignToContact,
UIActivityType(rawValue: "com.apple.reminders.RemindersEditorExtension"),
UIActivityType(rawValue: "com.apple.mobilenotes.SharingExtension"),
UIActivityType(rawValue: "?")]
答案 0 :(得分:2)
您可以使用
排除Facebook MessengerUIActivityType(rawValue: "com.facebook.Messenger.ShareExtension")
如果您需要检查用户可以使用哪种共享类型
let activityVC = UIActivityViewController(activityItems: [message, "\n", URL(string:link) as Any], applicationActivities: nil)
activityVC.completionWithItemsHandler = { activity, success, items, err in
if !success {
print("SHARE ABORTED")
return
}
if activity == UIActivityType.postToFacebook {
print("SHARE TO FACEBOOK")
}
if activity == UIActivityType.init(rawValue: "net.whatsapp.WhatsApp.ShareExtension") {
print("SHARE TO Whatsapp")
}
if activity == UIActivityType.init(rawValue: "com.facebook.Messenger.ShareExtension") {
print("SHARE TO FB MESSENGER")
}
}