【发布时间】:2018-04-19 22:57:54
【问题描述】:
正如标题所示,我想在现有应用程序上实现 iCloud Drive 支持,其中 ubiquity 容器以旧样式 $(TeamIdentifierPrefix) 为前缀。对于我的一生,我无法让它发挥作用。
最初我尝试了 Apple 自己的步骤,详情如下:https://developer.apple.com/library/content/documentation/General/Conceptual/iCloudDesignGuide/Chapters/DesigningForDocumentsIniCloud.html#//apple_ref/doc/uid/TP40012094-CH2-SW20
不幸的是,这不起作用。 (我记得每次构建都会增加捆绑版本)
按照这篇文章中提供的步骤:iCloud Drive Folder,我能够让我的应用程序出现在 iCloud Drive 中,但是我现有的文档无法访问,因为它们位于例如X123F4563T8.com.example.app 而不是新创建的 iCloud.com.example.app。
我尝试了无数种不同标识符配置的变体,试图让 iCloud Drive 指向旧的 ubiquity 容器,但无济于事。
我的权利文件如下所示(使用我的应用自己的标识符):
<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 文档的因素
$(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>
但是,this 的值似乎对结果没有影响。
【问题讨论】:
标签: ios icloud icloud-drive