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?

Answers


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.


Need Your Help

Selectively filling a dataset

c# database .net-3.5

I need to change what rows are grabbed from the database based upon a few flags. How can I do this? My current code is like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.