Is CFBundleTypeIconFile array mandatory for adding custom file type support on iOS app?

1.5k views Asked by At

Is CFBundleTypeIconFile array mandatory for adding custom file type support on iOS app? I've found different information on iOS SDK help.

We see here that the CFBundleTypeIconFile array is mandatory:

The entry for each document type should contain the following keys:

CFBundleTypeIconFile
CFBundleTypeName
CFBundleTypeRole

In addition to these keys, it must contain at least one of the following keys:

LSItemContentTypes
CFBundleTypeExtensions
CFBundleTypeMIMETypes
CFBundleTypeOSTypes

https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW9

And here we can read that the CFBundleTypeIconFile array is not mandatory:

Each dictionary in the CFBundleDocumentTypes array can include the following keys:

CFBundleTypeName specifies the name of the document type.
CFBundleTypeIconFiles is an array of filenames for the image resources to use as the document’s icon.
LSItemContentTypes contains an array of strings with the UTI types that represent the supported file types in this group.
LSHandlerRank describes whether this application owns the document type or is merely able to open it.

https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1

Where is the truth? Can I use the empty array? I just don't want to specify custom images for files to use app icon by default.

2

There are 2 answers

1
Dmitry On BEST ANSWER

File icons look fine without special icons inside the bandle.

0
trss On

There are two similar keys.

  • CFBundleTypeIconFile applicable only for macOS
  • CFBundleTypeIconFiles applicable only for iOS

Looks like this detail in the fifth column named "Platforms" resolves the seeming discrepancy in the documentation.

EDIT: Found further related information in the documentation:

The way you specify icon files in macOS and iOS is different because of the supported file formats on each platform. In iOS, each icon resource file is typically a PNG file that contains only one image. Therefore, it is necessary to specify different image files for different icon sizes. However, when specifying icons in macOS, you use an icon file (with extension .icns), which is capable of storing the icon at several different resolutions.