Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating your own UTI for an iOS app

The app I'm developing has a custom file format for its files, and I'd like to be able to use the "Open In ..." feature of iOS which lets users e.g. email each other a file and then open it directly in the app.

I've gotten as far as adding the CFBundleDocumentType stuff in the Info.plist file, but the problem is the LSItemContentTypes. From what I've read, I need to provide the actual file as a UTI, rather than just saying ".myfileextension", and I can't find a lot about how to create UTI's in a iOS app.

Anyone know?

like image 347
Kalle Avatar asked Dec 27 '10 15:12

Kalle


1 Answers

You will want to read up on the following topics from Apple:

Adopting Uniform Type Identifiers
Introduction to Uniform Type Identifiers Overview
Declaring New Uniform Type Identifiers

From the documentation:

If your application uses proprietary data formats, you should declare them in the Info.plist file of your application bundle. Some guidelines:

  • Your UTI string must be unique. Following the reverse-DNS format beginning with com.companyName is a simple way to ensure uniqueness. While the system can support different UTI strings with the same specification, the reverse is not true.

  • If your code relies on third-party UTI types that may not be present on the system, you should declare those UTIs as imported types in your bundle.

  • Be sure to add conformance information if your proprietary type is a subtype of one or more existing types. In most cases you should not specify conformance to a nonpublic type, unless you are also declaring that type in your bundle. For a list of public and Apple-defined UTIs, see "System-Declared Uniform Type Identifiers"

like image 192
Wayne Hartman Avatar answered Oct 08 '22 00:10

Wayne Hartman