When I copy a file from a local application to iCloud, the file is copied, but I got this error: Domain Error = NSCocoaErrorDomain Code = 512 "Operation could not be completed. (Cocoa error 512.)"
Here is the code
NSString *source = [tagsPath stringByAppendingPathComponent:current_Group_Name]; source = [source stringByAppendingPathComponent:fileName]; NSURL *sourceURL = [NSURL fileURLWithPath:source]; dispatch_queue_t q_default; q_default = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(q_default, ^(void) { fileManager = [NSFileManager defaultManager]; NSURL *ubiq = [fileManager URLForUbiquityContainerIdentifier:nil]; if (ubiq) { NSURL *groupURL = [tagsURL URLByAppendingPathComponent:current_Group_Name]; NSError *error= nil; NSURL *destinationURL = [groupURL URLByAppendingPathComponent:fileName]; [fileManager setUbiquitous:YES itemAtURL:sourceURL destinationURL:destinationURL error:&error]; if (error != nil) { NSLog( @"Error > %@",error); [self displayError:NSLocalizedString(@"XMP file not saved in iCloud.", @"") withReason:[NSString stringWithFormat:@"%@%d",NSLocalizedString(@"Error code : ", @""),[error code]]];} dispatch_queue_t q_main = dispatch_get_main_queue(); dispatch_async(q_main, ^(void) { }); });
Any suggestions?
thanks
source share