Documents not showing in the "Recents" tab.

I have a document-based app which uses its own file type, here's a snapshot of how I declare the UTI in Info.plist:

<key>UTExportedTypeDeclarations</key>


<array>

<dict>

<key>UTTypeConformsTo</key>

<array>

<string>com.apple.package</string>

<string>public.data</string>

</array>

<key>UTTypeDescription</key>

<string>MyApp Document</string>

<key>UTTypeIdentifier</key>

<string>com.my-app-company.my-app</string>

<key>UTTypeTagSpecification</key>

<dict>

<key>public.filename-extension</key>

<array>

<string>myapp</string>

</array>

</dict>

</dict>

</array>


And here's how it's declared as document type

<key>CFBundleDocumentTypes</key>


<array>

<dict>

<key>CFBundleTypeIconFiles</key>

<array/>

<key>CFBundleTypeName</key>

<string>MyApp Document</string>

<key>CFBundleTypeRole</key>

<string>Editor</string>

<key>LSHandlerRank</key>

<string>Owner</string>

<key>LSItemContentTypes</key>

<array>

<string>com.my-app-company.my-app</string>

</array>

<key>LSTypeIsPackage</key>

<true/>

</dict>

</array>


But after user created/modified any documents, they never show up in the Recents tab in the Files.app. Could anyone point out what's missing?


Thanks

-Robin

You shouldn't specify UTI conformance to both "com.apple.package" and "public.data". On or the other.


Also, you don't need to specify LSTypeIsPackage. See:


https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html


in Table 2 under the heading "CFBundleDocumentTypes" for which keys are no longer used.

Thanks for your reply.


I removed "public.data" from UTI conformance and also removed the LSTypeIsPackage key from document types. But still nothing shows up in the Recents tab. Any ideas?

I can't think of anything obvious that affects the Recents tab directly, but you still have a couple of errors in your document type.


— You've specified a role, but the document I linked to says that the "CFBundleTypeRole" key is macOS only.


— You've specified an empty array for the app icons. I suspect it must contain at least one file name.


If you still can't figure it out, I suggest you try creating a new test app from the Xcode document-based app template, and compare your plist to the one it provides by default. You might spot some other difference that will lead you to a solution.

Documents not showing in the "Recents" tab.
 
 
Q