【问题标题】:Can't copy MS Word document to my app from iOS Word app无法从 iOS Word 应用程序将 MS Word 文档复制到我的应用程序
【发布时间】:2016-08-15 20:41:53
【问题描述】:

我想在我的应用程序的委托函数中打开一个 Word 文件

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options

并通过添加到我的 Info.plist

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>doc</string>
        </array>
        <key>CFBundleTypeIconFile</key>
        <string>AppIcon.icns</string>
        <key>CFBundleTypeName</key>
        <string>Microsoft doc</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.microsoft.word.doc</string>
        </array>
    </dict>
</array>

当我在 Google Inbox 应用程序中打开附有 Word 文档的电子邮件时,我在文档交互控制器中看到我的应用程序,并且 Word 文件的副本被发送到委托函数。

但是,当我在 iOS Word 应用程序中通过点击最近文件列表中 Word 文件后面的“...”打开文档交互控制器时,然后:“共享”>“发送副本”>“与其他人一起发送应用程序”我的应用程序在文档交互控制器中不可见。

要在 iOS Word 应用程序的文档交互控制器中查看我的应用程序以在我的应用程序中编辑 Word 文件,我应该做哪些更多或不同的操作?

【问题讨论】:

    标签: ios objective-c swift ms-word


    【解决方案1】:

    看来您必须在 Info.plist 中提到 LSItemContentTypes 符合 org.openxmlformats.wordprocessingml.document 格式

    所以 Info.plist 将变为:

    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>doc</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>AppIcon.icns</string>
            <key>CFBundleTypeName</key>
            <string>Microsoft Word</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
              <string>com.microsoft.word.doc</string>
              <string>org.openxmlformats.wordprocessingml.document</string>
            </array>
        </dict>
    </array>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多