Reputation: 11197
I am trying to add an option so that while pressing the share button of a PDF file it'll suggest opening with my app. Like this:
Currently my plist file has CFBundleDocumentTypes
and UTImportedTypeDeclarations
properties and lookes like this:
I've followed this tutorial but no luck. My app doesn't show up in the list. What am I missing?
Upvotes: 3
Views: 2380
Reputation: 318774
You should not have the UTImportedTypeDeclarations
for PDF. PDF is a standard provided UTI so you should not be declaring your own non-standard UTI. You only ned the CFBundleDocumentTypes
section with the correct UTI for PDF files, not your made up one.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alertnate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
Upvotes: 1
Reputation: 3446
After adding com.adobe.pdf in CFBundleDocumentTypes- info.plist files , ios allow to open pdf file with your app. Sharing with yourApp is different thing.
To check how it works with what you have done, Open pdf in safari and check open with menu, you will see your app there.
To get Share With Option (the way you have described in screenshot) , you need to implement share extension. You can read more about it from Apple's Developer website
Update:
for supporting PDF documents, LScontentItemTypes should contain "com.adobe.pdf"
Upvotes: 0