クラウドに 15.2 kb のファイルがあります。アプリのサンドボックスにコピーできません。私のコードを以下に示します。どんな助けでも大歓迎です
NSURL *ubiq = [[NSFileManager defaultManager]
URLForUbiquityContainerIdentifier:nil];
if (ubiq)
{
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *cloudContainerURL = [fileManager URLForUbiquityContainerIdentifier:nil]:
NSURL*dirURL=[cloudContainerURL URLByAppendingPathComponent:@"Documents" isDirectory:YES];
[fileManager createDirectoryAtURL:dirURL withIntermediateDirectories:NO attributes:nil error:&error];
NSURL *icloudURL = [dirURL URLByAppendingPathComponent:@"Passwords File.txt"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
// Destination path
NSString *fileInDocumentsPath = [documentsPath stringByAppendingPathComponent:@"Passwords File.txt"];
NSURL* sandboxDocumentURL = [NSURL fileURLWithPath:fileInDocumentsPath];
[[ NSFileManager defaultManager ] copyItemAtURL:icloudURL toURL:sandboxDocumentURL error:&error ];