iphone - 将文件类型与我的 Iphone 应用相关联

标签 iphone ios cocoa-touch file-type

我正在尝试将文件类型与我的应用程序(pdf 和 doc)相关联。 对于pdf,没关系。我读了这个主题:How do I associate file types with an iPhone application?

而且效果很好。但我尝试添加 .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>

希望对大家有帮助:)

最好的问候,

最佳答案

这是 Doc 文件格式的代码,但它可能不适用于图像。

<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Word</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.word.doc</string>
            <string>com.microsoft.word.wordml</string>
            <string>org.openxmlformats.wordprocessingml.document</string>
        </array>
    </dict>

关于iphone - 将文件类型与我的 Iphone 应用相关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15836145/

相关文章:

iphone - 适用于 iPad 的漂亮 "waiting view"?

ios - 苹果应用程序评论 : Demo Account for Instagram?

ios - 使用 Storyboard时 IBoutlets swift 为零

ios - 应用程序内购买崩溃的应用程序没有互联网连接

ios - 检查 NSDate 是否为星期一/星期二/等

ios - 检测应用程序何时从锁定屏幕与 iOS 7 上的其他屏幕激活

ios - 如何在 UNNotificationRequest 中设置重复间隔和触发日期

iphone - UIScrollView ContentOffset 未到达屏幕边缘

iPhone 构建问题 : MapKit/MKPolyline. h:没有这样的文件或目录

ios - 在 TextView 中显示多行