Take the 2-minute tour ×  I'm trying to copy a file to iCloud
using the follow code:      NSError *error;     //My Image
Source file     NSURL *sourceURL = [NSURL
fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"_219"
ofType:@"jpg"]isDirectory:NO];     NSLog(@"source: %@",
sourceURL);      NSFileManager *fileManager = [NSFileManager
defaultManager];     //Discovering iCloud URL    NSURL
*iCloudDocumentsURL = [[fileManager
URLForUbiquityContainerIdentifier:nil]
URLByAppendingPathComponent:@"Documents"];
NSLog(@"iCloudDocumentsURL: %@", iCloudDocumentsURL);
//Setting destination URL    NSURL *destinationURL =
[iCloudDocumentsURL URLByAppendingPathComponent:@"image.jpg"];
NSLog(@"destination: %@", destinationURL);     //Copy file to
iCloud    BOOL success = [fileManager setUbiquitous:YES
itemAtURL:sourceURL destinationURL:destinationURL error:&error];
if (!success) {        @throw [NSException
exceptionWithName:[error localizedDescription] reason:[error
localizedFailureReason] userInfo:nil]