我正在尝试将文件类型(pdf和doc)与我的应用程序进行关联。关于pdf,一切正常。我阅读了这个主题:如何将文件类型与iPhone应用程序关联?
希望对某些人有所帮助:)
最好的问候,
它完美地运作了。但是我尝试添加.doc类型,但无法使用。
编辑: 使用此代码成功关联PDF、WORD和EXCEL格式:
这是我的app-info.plist文件:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
</array>
<key>CFBundleTypeName</key>
<string>My Apps Files</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.composite-content</string>
<string>public.data</string>
<string>public.content</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.adobe.pdf</string>
<key>UTTypeDescription</key>
<string>PDF Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.composite-content</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>pdf</string>
</array>
<key>public.mime-type</key>
<string>application/pdf</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.microsoft.word.doc</string>
<key>UTTypeDescription</key>
<string>Word Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>doc</string>
</array>
<key>public.mime-type</key>
<string>application/msword</string>
</dict>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.microsoft.excel.xls</string>
<key>UTTypeDescription</key>
<string>Excel Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>xls</string>
</array>
<key>public.mime-type</key>
<string>application/vnd.ms-excel</string>
</dict>
</dict>
</array>
希望对某些人有所帮助:)
最好的问候,
UTImportedTypeDeclarations
,因为你不是这些类型的所有者。可以参考 Microsoft Word 的Info.plist
内容作为一个很好的例子。 - adib