Can anyone explain to me the difference between Document Types, Exported UTIs and Imported UTIs in Xcode 5.1? I want to be able to have my app automatically detect file type based on file extension. Which of these three would I need to implement in order to do that?
You add a Document Type to register that your app can open that Document Type, this is simple when you select a known file type, but if the file type is not known, you must also define it in Imported UTIs. And if you are the defining your own File Type you must declare it in Exported UTIs and add that Document Type to be able to open it.
Examples:
I want to open a PDF, which is a known file type, so I just register it in Document Types.
I want to open an EPUB, which isn't a known file type, so I register it in Imported UTIs and in Document Types.
I want to open and register a type that I'm authoritative of, so I register it in Exported UTIs and in Document Types.
As for your second question, please note that defining a type using a Document Type will make your app appear in the "Open in" dialog, but not necessarily will make your app distinguish between which type of file your app is receiving, you must take care of handling that yourself. For example, let's say that your app is an image editor, and you registered both png and jpeg types, when the user wants to edit an image your app will receive the file but it won't be detecting which type is automatically, you'll have to process the file and respond to whatever type it is.
Some relevant links:
UIDocumentPicker
but on my customer’s device files of that type are ghosted and cannot be opened. Does UIDocumentPicker
also follow the document types and imported UTIs ? –
Underclothing © 2022 - 2024 — McMap. All rights reserved.