アプリで coredata と icloud を使用しています。iCloud で UIManagedDocument を作成し、iPhone5 以外のデバイスでアプリをデバッグすると、正常に動作します。しかし、iPhone でデバッグすると、以下のようなエラーが表示されます。
6 月 26 日 15:49:49 Kumar-iPhone librariand[12461]: file://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258L~com~leaf~Journal/COREDATABASE/ (0x8000000000000000) をダウンロードできません:操作を完了できませんでした。(UBErrorDomain エラー 0.) ��Jun 26 15:49:58 Kumar-iPhone librariand[12461] : ファイルをダウンロードできません://localhost/private/var/mobile/Library/Mobile%20Documents/3JPA4W258Lh~com~leaf~ Journal/Logs/ (0x8000000000000000): 操作を完了できませんでした。(UBErrorDomain エラー 0.) ��Jun 26 15:49:58 Kumar-iPhone Journal[12554]: -PFUbiquityImportScanOperation main: CoreData: Ubiquity: Unable to get subpaths of root path (0): /private/var/mobile/Library /Mobile Documents/3JPA4W258L~com~leaf~Journal/Logs Error: (null) userInfo: (null) ��Jun 26 15:49:58 Kumar-iPhone Journal[12554] :
コードを以下に示します。
-(void)saveManagegDocument {
if(iCloud) {
NSError * error = nil;
[coordinator coordinateWritingItemAtURL:managedDoc.fileURL options:NSFileCoordinatorWritingForDeleting error:&error byAccessor:^(NSURL *newURL) {
NSError * delError = nil;
[[NSFileManager defaultManager] removeItemAtURL:newURL error:&delError];
//if(delError)
//NSLog(@"Error deleting data file .... , reason : %@",delError.localizedDescription);
}];
NSError * logerror = nil;
[coordinator coordinateWritingItemAtURL:[managedDoc.persistentStoreOptions valueForKey:NSPersistentStoreUbiquitousContentURLKey] options:NSFileCoordinatorWritingForDeleting error:&logerror byAccessor:^(NSURL *newURL) {
NSError * delError = nil;
[[NSFileManager defaultManager] removeItemAtURL:newURL error:&delError];
//if(delError)
//NSLog(@"Error deleting transaction file .... , reason : %@",delError.localizedDescription);
}];
}
[managedDoc saveToURL:managedDoc.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
if (success) {
[managedDoc closeWithCompletionHandler:^(BOOL success) {
[managedDoc openWithCompletionHandler:^(BOOL success) {
[self performSelectorOnMainThread:@selector(documentReady) withObject:nil waitUntilDone:NO];
}];
}];
} else {
[[[UIAlertView alloc] initWithTitle:@"Could not save or open core data database." message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
// [self showMessage:@"Could not save or open core data database "];
//NSLog(@"Could not save or open core data database ");
}
}];
}
それで、もしあれば答えを書いてください。
ありがとう。