I'm developing a custom UTI like "com.xyz".
All the apps supporting this UTI may be shown in the UIActivityViewController
.
Code snippet:
let extensionItem = NSExtensionItem()
let data = NSItemProvider.init(item: nil, typeIdentifier: "com.xyz")
extensionItem.attachments = [data]
let activity = UIActivityViewController(
activityItems: [extensionItem],
applicationActivities: nil
)
present(activity, animated: true, completion: nil)
In order to have a better user experience, I would like to check if the iOS device has any App supporting "com.xyz" before presenting the UIActivityViewController
.
Just like check URL:
UIApplication.shared.canOpenURL(URL(string: urlStr)!)
Otherwise the user may see an empty UIActivityViewController
without any app.
As I know, there is an ActivityNotFoundException
could be try and catch to handle the app not found situation in Android.
Does iOS support something like ActivityNotFoundException
?
THANKS!