简体   繁体   English

如何使用CloudKit中的资产?

[英]How do I use assets in CloudKit?

I'm trying to use CloudKit with assets. 我正在尝试将CloudKit与资产一起使用。

I created RecordType includes an asset in iCloud developer dashboard. 我创建的RecordType在iCloud开发人员仪表板中包括资产。

Then, I created a record in default zone of public database and uploaded a file to the record's asset. 然后,我在公共数据库的默认区域中创建了一条记录,并将文件上传到该记录的资产。

I wrote this code to get the record. 我写了这段代码来获取记录。

CKContainer *defaultContainer =[CKContainer defaultContainer];
CKDatabase *publicDatabase = [defaultContainer publicCloudDatabase];
CKRecordID *wellKnownID = [[CKRecordID alloc]
                           initWithRecordName:@"RECORDKEY"];

[publicDatabase fetchRecordWithID:wellKnownID
                completionHandler:^(CKRecord *fetchedParty, NSError *error) {
                    NSLog(@"erorr : %@", error)
                }];

And I got this error message. 而且我收到了此错误消息。

2014-06-28 21:42:50.148 AppName[10634:1068121] erorr : <CKError 0xc81b4a0: "Internal Error" (1/5001); 2014-06-28 21:42:50.148 AppName [10634:1068121] erorr:<CKError 0xc81b4a0:“内部错误”(1/5001); "Record <CKRecordID: 0xc035b50; RECORDKEY:(_defaultZone:__defaultOwner__)> has items that require encryption but no protection data was found on the record"> “记录<CKRecordID:0xc035b50; RECORDKEY:(_ defaultZone:__ defaultOwner __)>具有需要加密但在记录上未找到保护数据的项目“>

What is "protection data"? 什么是“保护数据”? Should I encrypt data before upload? 上传之前我应该​​加密数据吗?

Did you upload the data using the web console? 您是否使用网络控制台上传了数据? I've experienced this too when doing that. 我这样做时也经历过。 So far my workaround has been to upload the assets using a device and then using them as normal. 到目前为止,我的解决方法是使用设备上传资产,然后正常使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM