CFBundleDocumentTypes not working with non-public UTI in iOS app

1.6k views Asked by At

I want to add ability to open some specific types of audio in my app: .caf, .aiff, .wav and .mp3. I've added 'Document Types' item to the info.plist according to the official guide. Here is a screenshot: enter image description here And the source code of the info.plist:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>Audio</string>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.mp3</string>
            <string>public.aiff-audio</string>
            <string>public.aifc-audio</string>
            <string>com.apple.coreaudio-​format</string>
            <string>com.microsoft.waveform-​audio</string>
        </array>
    </dict>
</array>

The problem in question

The problem is that the app is missing in the "Open in..." dialog for .caf and .wav files. I guess because UTIs for that files have no public. perfix.

1

There are 1 answers

2
vaibby On

some missing extension no problem with that.

<key>CFBundleDocumentTypes</key>
 <array>
<dict>
    <key>CFBundleTypeName</key>
    <string>Audio</string>
    <key>CFBundleTypeIconFiles</key>
    <key>LSHandlerRank</key>
    <string>Alternate</string>
    <key>CFBundleTypeRole</key>
    <string>Viewer</string>
    <key>LSItemContentTypes</key>
    <array>
        <string>public.aiff-audio</string>
        <string>public.aifc-audio</string>
        <string>com.apple.coreaudio-​format</string>
        <string>com.microsoft.waveform-​audio</string>
        <string>public.audio</string>
        <string>public.mp3</string>
        <string>public.mpeg-4-audio</string>
        <string>com.apple.protected-​mpeg-4-audio</string>
        <string>public.aifc-audio</string>
        <string>com.apple.coreaudio-​format</string>
        <string>public.aiff-audio</string>
    </array>
</dict>
<dict>
        <key>CFBundleTypeName</key>
        <string>Waveform audio</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.waveform-​audio</string>
        </array>
    </dict>
</array>