Unable to download an CKAsset, I find maybe cause I uploaded it using the dashboard. Now I find I am unable to upload a CKAsset with this code either. Obviously the recordIDs listed here have been changed.
NSArray *germanMakes = @[@"963ad20a-756b-I-A-X"];
NSArray *moduleMakes = @[@"33ef0a6b-013d-J-B-Y"];
NSMutableArray *localChanges = [NSMutableArray array];
for (int i=0; i<[germanMakes count]; i++) {
CKRecordID *wellKnownID = [[CKRecordID alloc] initWithRecordName:germanMakes[i]];
CKRecord *record = [[CKRecord alloc] initWithRecordType:@"Slides" recordID:wellKnownID];
record[@"fullName"] = [NSString stringWithFormat:@"Week %d",i];
record [@"presentationReference"] = [[CKReference alloc] initWithRecordID:moduleMakes[i] action:CKReferenceActionDeleteSelf];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths firstObject];
NSString *slideName = [NSString stringWithFormat:@"slide%d",i]; // slide01 name of asset.xcassets
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:slideName];
NSURL *fileUrl = [[NSURL alloc] initFileURLWithPath:fullPath];
[localChanges addObject:record];
}
CKModifyRecordsOperation *modifyRecordsOperation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:localChanges recordIDsToDelete:nil];
modifyRecordsOperation.savePolicy = CKRecordSaveAllKeys;
modifyRecordsOperation.modifyRecordsCompletionBlock = ^(NSArray *savedRecords, NSArray *deletedRecordIDs, NSError *error) {
if (error) {
NSLog(@"[%@] Error pushing local data: %@", self.class, error);
}
};
[privateDB addOperation:modifyRecordsOperation];
What is wrong with this code; and why is iCloud telling me...
2015-12-23 17:08:27.506 Blah[586:160560] [ViewController] Error pushing local data: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.cloudd" UserInfo={NSDebugDescription=connection to service named com.apple.cloudd}