0
votes

I want to associate files with specific extension with iOS App. I have successfully associated other file types like .obj, .stl, etc. using link: How do I associate file types with an iPhone application?

But for files which have "_" underscore in the extension fail to get associated. It is failing for files with extension .x_t

Apple UTI guidelines say that https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html#//apple_ref/doc/uid/TP40001319-CH202-CHDHIJDE

The UTI Character Set A uniform type identifier is a Unicode string that usually contains characters in the ASCII character set. However, only a subset of the ASCII characters are permitted. You may use the Roman alphabet in upper and lower case (A–Z, a–z), the digits 0 through 9, the dot (“.”), and the hyphen (“-”). This restriction is based on DNS name restrictions, set forth in RFC 1035.

Uniform type identifiers may also contain any of the Unicode characters greater than U+007F.

Important: Any illegal character appearing in a UTI string—for example, underscore ("_"), colon (":"), or space (" ")—will cause the string to be rejected as an invalid UTI. At the API layer, no error is generated for invalid UTIs.

So is there any way around to associate x_t files with the iOS App?

1
The UTI character set refers to the UTI, not the file extension. You cannot have an UTI that is e.g. com.you.x_t, but you should ba able to have a file extension of x_t set up for if. For UTI you could have com.you.x-t though.Sami Kuhmonen

1 Answers

0
votes

Use UTI as com.you.x-t and file extension as x_t.

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array>
        </array>
        <key>CFBundleTypeName</key>
        <string>x_t file</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.you.x-t</string>
        </array>
    </dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.item</string>
        </array>
        <key>UTTypeDescription</key>
        <string>x_t files</string>
        <key>UTTypeIdentifier</key>
        <string>com.you.x-t</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <string>x_t</string>
        </dict>
    </dict>
</array>

UTI: com.you.x_t & file extension x_t does not work

UTI: com.you.x-t & file extension x-t does not work