0

アプリで 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 ");
        }
    }];
}

それで、もしあれば答えを書いてください。

ありがとう。

4

1 に答える 1

0

これらは内部の iCloud + Core Data エラーです。それらはあなたが何か間違ったことをしたという意味ではなく、より良く機能するために変更できるものはありません. iCloudはそれを単に行う場合もあれば、1つのデバイスでのみ行う場合もあれば、さまざまなデバイスでランダムに行う場合もあります。あなたの唯一の選択肢は、後で再試行して、より良い結果を期待することです.

誰もが望んでいる答えではないことはわかっていますが、それが現在の Core Data と iCloud の現状です。バグを報告するか、iOS 7 で試して、そちらの方が優れているかどうかを確認してください。

于 2013-06-26T23:35:08.343 に答える