在设备重启之前,iCloud无法识别软件包

时间:2022-06-04 21:13:59

Our UIDocument based app has a custom document type defined in the info.plist under the “Exported Type UTIs” and “Document types”. We are creating UIDocuments in the iCloud ubiquity container as per Apple documentation. The documents are not getting registered as a package until the device is restarted. This happens only for the first time the app is installed. After restart, any new documents created will be treated as packages of our custom type (as it should be).

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

Info.plist has the following entries:

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>

When the metadata query returns the results, the contentType will be “dyn.” (which is the problem). Once the device is restarted, contentType for new documents will be com.sampledoc.tst (which is the expected value).

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

Did anyone else face this problem? Any help will be appreciated.

有没有人面对这个问题?任何帮助将不胜感激。

1 个解决方案

#1


0  

I also posted the same question in apple forum, below is reply from Apple

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

Thank you for your inquiry to Apple Worldwide Developer Technical Support. I am responding to let you know that I have received your request for technical assistance.

感谢您对Apple Worldwide Developer Technical Support的询问。我的回复是告诉您我已收到您的技术协助请求。

I looked over your sample project and did not find an entry for “CFBundleTypeExtensions”.

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

Your “UTExportedTypeDeclarations” is defined correctly, but for “CFBundleDocumentTypes” you are missing an entry for “CFBundleTypeExtensions”.

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

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

Add that entry and you should see your package recognized.

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

#1


0  

I also posted the same question in apple forum, below is reply from Apple

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

Thank you for your inquiry to Apple Worldwide Developer Technical Support. I am responding to let you know that I have received your request for technical assistance.

感谢您对Apple Worldwide Developer Technical Support的询问。我的回复是告诉您我已收到您的技术协助请求。

I looked over your sample project and did not find an entry for “CFBundleTypeExtensions”.

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

Your “UTExportedTypeDeclarations” is defined correctly, but for “CFBundleDocumentTypes” you are missing an entry for “CFBundleTypeExtensions”.

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

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

Add that entry and you should see your package recognized.

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