iCloud 查询错误

今天调试iCloud的时候遇到了这个问题

 *** -[NSFileManager URLForUbiquityContainerIdentifier:]: An error occurred while getting ubiquity container URL: Error Domain=LibrarianErrorDomain Code=11 "The operation couldn’t be completed. (LibrarianErrorDomain error 11 - The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.)" UserInfo=0x1d56a5b0 {NSDescription=The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.}

查询不到结果

查询的URL的代码是这样的:

NSString *containerId = @"com.mycompany.myapp";
NSURL *iCloudURL = [[fileManager URLForUbiquityContainerIdentifier:containerId];
NSLog(@"%@", [iCloudURL absoluteString]);

后来通过上网查询后,发现是少了一个前缀名

前缀得在provision文件里找<dict>
        <key>application-identifier</key>
        <string>AAAAAA.com.mycompany.*</string>
        <key>com.apple.developer.default-data-protection</key>
        <string>NSFileProtectionComplete</string>
        <key>com.apple.developer.pass-type-identifiers</key>

然后把那个前缀加进去就正常了

NSString *containerId = @"YYYYYYY.com.mycompany.myapp";
NSURL *iCloudURL = [[fileManager URLForUbiquityContainerIdentifier:containerId];
NSLog(@"%@", [iCloudURL absoluteString]);



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值