user3786678
user3786678

Reputation: 431

How do I use assets in CloudKit?

I'm trying to use CloudKit with assets.

I created RecordType includes an asset in iCloud developer dashboard.

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); "Record <CKRecordID: 0xc035b50; RECORDKEY:(_defaultZone:__defaultOwner__)> has items that require encryption but no protection data was found on the record">

What is "protection data"? Should I encrypt data before upload?

Upvotes: 8

Views: 1460

Answers (1)

Mike Katz
Mike Katz

Reputation: 2080

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.

Upvotes: 2

Related Questions