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.