Skip to content

Commit

Permalink
Pushing to iCloud done
Browse files Browse the repository at this point in the history
  • Loading branch information
MugunthKumar committed Feb 11, 2012
1 parent 548c66c commit 202646a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MKDocumentSync.m
Expand Up @@ -106,19 +106,19 @@ -(void) pushToiCloud {

MKDocument *thisDocument = [[MKDocument alloc] initWithFileURL:[NSURL fileURLWithPath:filePath]];
NSString *relativePath = [filePath stringByReplacingOccurrencesOfString:docsDirectory withString:@""];

relativePath = [relativePath stringByReplacingOccurrencesOfString:@"/" withString:@""];
NSURL *iCloudFirstContainer = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];
NSString *iCloudDestinationURLString = [[iCloudFirstContainer absoluteString] stringByAppendingString:relativePath];
NSURL *iCloudDestinationURL = [iCloudFirstContainer URLByAppendingPathComponent:relativePath];

NSError *error = nil;
[[NSFileManager defaultManager] setUbiquitous:YES
itemAtURL:thisDocument.fileURL
destinationURL:[NSURL URLWithString:iCloudDestinationURLString]
destinationURL:iCloudDestinationURL
error:&error];

if(error) DLog(@"%@", error);

DLog(@"Moving [%@] to iCloud location at [%@]", [thisDocument.fileURL absoluteString], iCloudDestinationURLString);
DLog(@"Moving [%@] to iCloud location at [%@]", thisDocument.fileURL, iCloudDestinationURL);
}
}

Expand Down

0 comments on commit 202646a

Please sign in to comment.