PenguinProgramer的专栏

CSDN学院讲师招募,诚邀您加入!博客Markdown编辑器上线啦那些年我们追过的Wrox精品红皮计算机图书PMBOK第五版精讲视频教程火星人敏捷开发1001问

iCloud 查询错误

分类:ios

今天调试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]);

上一篇用宏实现的单例模式下一篇优化笔记

主题推荐猜你在找

查看评论

* 以上用户言论只代表其个人观点,,不代表CSDN网站的观点或立场

核心技术类目

巨龟千岁,却也平淡无奇;昙花瞬间,却能绚丽无比。

PenguinProgramer的专栏

相关文章:

你感兴趣的文章:

标签云: