I'd like to create a file associate with tiff files in my iOS app (i.e. so that my app appears as a target for opening tiff files from Mail or Safari). Adding the following to my Info.plist file doesn't seem to work:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>tiff</string>
<key>LSItemContentTypes</key>
<array>
<string>public.tiff</string>
</array>
<key>LSHandlerRank</key>
<string>Alternate</st开发者_如何学Cring>
</dict>
</array>
I have an app that I associate with PDFs in the same way and it works fine. I believe that it is not possible to associate an app with the tiff file type on iOS, but I can't find any documentation stating that.
Has anyone else had luck getting this to work or finding a definitive "no, you can't do that"?
I burned an Apple TSI on this (I never seem to end up using them anyway) and the official answer is: no, you can't do that.
I've logged an enhancement request on Apple's bug reporting site: http://developer.apple.com/bugreporter/ and I suggest you do too if this issue is a problem for you.
Acorn declares file associations for TIFFs, which seems to work fine.
The only differences I could see between Acorn's implementation and yours is that Gus omits CFBundleTypeName and adds LSIsAppleDefaultForType (set to true). You might want to give that a try.
LSIsAppleDefaultForType is undocumented. There's a reference to it here: http://lists.apple.com/archives/cocoa-dev/2006/Jun/msg00747.html
An general note - the Mail and Safari apps indeed does not allow you to "open with .." tiff files (still true in iOS8);
Nevertheless, a lot of other apps, such as Dropbox, GDrive, etc, does allow you to do that.
精彩评论