In Part1, I showed you how to associate a known file type extension with your App. In this article, I will explain how to associate a custom/unknown file type extension.
The file type extension I will be using is ".cbr". Basically a cbr file is just a renamed Rar archive that contains comic book pages.
Its worth noting that you can replace "CBR" with any other file type extension. I just had to pick an uncommon file type extension and I went with this one b/c i'm a comic book nerd :)
Lets get started!!
1. Just like with Part1 - Click on your project and select the info tab
2. Expand the "Imported UTIs" section and click the "+" button at the bottom.
3. Fill in the following fields:
- Description - This can be whatever you want
- Identifier - This can be whatever you want, but you'll be using this value in a later step
- Conforms To - This is a list of items that describe your file extension - See apple's documentation for more details
- Expand "Additional Imported UTI Properties" and fill it out like the image below. (This is where we explain the file extensions we're supporting.
4. Expand the "Document Types" section and click the "+" button at the bottom.
5. And Finally, fill in the following fields:
- Name - This can be whatever you want
- Types - This MUST be the same as the "identifier" field that you filled in, in step 3.
And thats it!
Once your app is installed on an iOS device, it will be registered to open files types with your custom extension. So, if you were to use an app such as Dropbox and you had a .cbr file in your directory, once its downloaded, you can select to open it up in your registered app!
Hope this was helpful. And stay tuned for the final entry in this series, where i'll discuss where to find these files that you've opened into your app.
By Stephen Zaharuk (SteveZ)