I have an iOS app that I want to be able to send and receive instances of its own file type. The flow would be:
- User 1 selects a Share function in the app. This generates a file of my type (say, file.myextension) and shares it using a
UIActivityViewController
. They send it somehow to User 2 (AirDrop, email, whatever). - User 2 receives the file and opens it. The system offers to open it using my app.
I've got the first part working. I can generate file.myExtension and give the UIActivityViewController
a file URL to it. This shows up correctly in AirDrop on user 1's device, and I can transfer the file using AirDrop or email or whatever. But the receiving device refuses to show my app as an option to open the file.
I have tried:
- Declaring Exported and Imported UTIs and a Document Type as per this Apple Q&A. I've triple-checked that all the IDs are the same and all the plist keys are spelled correctly.
- I've tried both an Exported and Imported UTI alone (with a Document Type). This article seems to say that the Imported one is what I want if I want to open a file type. This SO answer says that registering a type I own and want to open means I just want Exported. Neither on its own worked.
My question: what do I have to do to be able to open a file extension that I own on iOS? Do I define both Imported and Exported UTIs, along with a Document Type? Just one of exported or imported? Any unexpected required attributes?