I need to create folders with some files in iCloud. Try the following:
NSString *folderName = [NSString stringWithFormat:@"folder_%@", [formatter stringFromDate:[NSDate date]]]; //iCloud folder NSURL *ubiq = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; NSURL *ubiquitousPackage = [[[ubiq URLByAppendingPathComponent:@"Documents"] URLByAppendingPathComponent:folderName]URLByAppendingPathComponent:@"file.txt"]; //NSLog(@"%@",ubiquitousPackage.relativePath); File *doc = [[File alloc] initWithFileURL:ubiquitousPackage]; [doc saveToURL:[doc fileURL] forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) { if (success) { } }];
It returns an error:
The fund is called mkdir ("/ private / var / mobile / Library / Mobile Documents / 6CVKW284XZ ~ com ~ ~ cloudmy rum / Documents / folder_20120209_194803 / (A Document saved by klp)"), it did not return 0, and errno was installed before 2.
source share