0
votes

Our UIDocument based app has a custom document type defined in the info.plist under the “Exported Type UTIs” and “Document types”. We are creating UIDocuments in the iCloud ubiquity container as per Apple documentation. The documents are not getting registered as a package until the device is restarted. This happens only for the first time the app is installed. After restart, any new documents created will be treated as packages of our custom type (as it should be).

Info.plist has the following entries:

<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeIconFiles</key>
            <array/>
            <key>CFBundleTypeName</key>
            <string>Sample Doc</string>
            <key>LSHandlerRank</key>
            <string>Owner</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.sampledoc.tst</string>
            </array>
            <key>LSTypeIsPackage</key>
            <true/>
        </dict>
    </array>
<key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>com.apple.package</string>
            </array>
            <key>UTTypeDescription</key>
            <string>Sample Doc</string>
            <key>UTTypeIdentifier</key>
            <string>com.sampledoc.tst</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>public.filename-extension</key>
                <array>
                    <string>tst</string>
                </array>
            </dict>
        </dict>
    </array>

When the metadata query returns the results, the contentType will be “dyn.” (which is the problem). Once the device is restarted, contentType for new documents will be com.sampledoc.tst (which is the expected value).

Did anyone else face this problem? Any help will be appreciated.

1

1 Answers

1
votes

I also posted the same question in apple forum, below is reply from Apple

Thank you for your inquiry to Apple Worldwide Developer Technical Support. I am responding to let you know that I have received your request for technical assistance.

I looked over your sample project and did not find an entry for “CFBundleTypeExtensions”.

Your “UTExportedTypeDeclarations” is defined correctly, but for “CFBundleDocumentTypes” you are missing an entry for “CFBundleTypeExtensions”.

<key>CFBundleTypeExtensions</key>
<array>
    <string>tst</string>
</array>

Add that entry and you should see your package recognized.