【问题标题】:iCloud not recognizing packages until device restartiCloud 在设备重新启动之前无法识别包
【发布时间】:2016-03-05 07:13:21
【问题描述】:

我们基于 UIDocument 的应用程序在 info.plist 的“Exported Type UTI”和“Document types”下定义了一个自定义文档类型。根据 Apple 文档,我们正在 iCloud 通用容器中创建 UIDocuments。在设备重新启动之前,这些文档不会被注册为一个包。这只发生在第一次安装应用程序时。重新启动后,创建的任何新文档都将被视为我们自定义类型的包(应该如此)。

Info.plist 有以下条目:

<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeIconFiles</key>
            <array/>
            <key>CFBundleTypeName</key>
            <string>Sample Doc</string>
            <key>LSHandlerRank</key>
            <string>Owner</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>com.sampledoc.tst</string>
            </array>
            <key>LSTypeIsPackage</key>
            <true/>
        </dict>
    </array>
<key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>com.apple.package</string>
            </array>
            <key>UTTypeDescription</key>
            <string>Sample Doc</string>
            <key>UTTypeIdentifier</key>
            <string>com.sampledoc.tst</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>public.filename-extension</key>
                <array>
                    <string>tst</string>
                </array>
            </dict>
        </dict>
    </array>

当元数据查询返回结果时,contentType 将为“dyn”。 (这是问题所在)。设备重启后,新文档的 contentType 将为 com.sampledoc.tst(这是预期值)。

还有其他人遇到过这个问题吗?任何帮助将不胜感激。

【问题讨论】:

    标签: ios icloud uidocument


    【解决方案1】:

    我也在苹果论坛发过同样的问题,下面是苹果的回复

    感谢您向 Apple 全球开发者技术支持咨询。 我正在回复您,通知您我已收到您的技术援助请求。

    我查看了您的示例项目,没有找到“CFBundleTypeExtensions”条目。

    您的“UTExportedTypeDeclarations”定义正确,但对于“CFBundleDocumentTypes”,您缺少“CFBundleTypeExtensions”条目。

    <key>CFBundleTypeExtensions</key>
    <array>
        <string>tst</string>
    </array>
    

    添加该条目,您应该会看到您的包裹已被识别。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-15
      • 2018-05-21
      • 2021-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多