正如标题所示,我想在现有应用程序上实现 iCloud Drive 支持,其中 ubiquity 容器以旧样式 $(TeamIdentifierPrefix) 为前缀。对于我的一生,我无法让它发挥作用。
不幸的是,这没有奏效。(我记得每次构建都会增加捆绑版本)
按照这篇文章中提供的步骤:iCloud Drive Folder,我能够让我的应用程序出现在 iCloud Drive 中,但是我现有的文档无法访问,因为它们位于例如 X123F4563T8.com.example.app 而不是新创建的 iCloud。 com.example.app。
我尝试了无数不同标识符配置的变体,试图让 iCloud Drive 指向旧的普遍存在的容器,但无济于事。
我的权利文件如下所示(使用我的应用程序自己的标识符):
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.example.AppName</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.example.AppName</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.example.AppName</string>
</array>
第一个关键似乎是决定使用哪个无处不在的目录。
之前设置为:
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>$(TeamIdentifierPrefix)com.example.AppName</string>
</array>
我缩小了搜索范围,发现这是此键的值似乎是是否使用(旧式)iCloud Documents 的决定因素
$(TeamIdentifierPrefix)com.example.AppName
或 iCloud 云盘,
iCloud.com.example.AppName
为了完整起见,我的 Info.plist 中包含以下内容:
<key>iCloud.com.example.AppName</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>App Name For Drive</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
我也没有忽略:
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.example.AppName</string>
</array>
但是,这个值似乎对结果没有影响。