UIDocument & NSFileWrapper - NSFastEnumerationMutationHandler when changing the file wrapper while saving

I have a based application UIDocumentthat uses NSFileWrapperto store data. The file wrapper "master" contains many additional catalog files, each of which represents a different page in the document.

Whenever I make changes to a document while it UIDocumentsaves (in writeContents:andAttributes:safelyToURL:forSaveOperation:error:), the application crashes. Here is the stack trace:

UIDocument crash stack trace

, , UIDocument . , , contentsForType:error: , , ( ) , .

- (id)contentsForType:(NSString *)typeName error:(NSError *__autoreleasing *)outError
{
    if (!_fileWrapper) {
        [self setupEmptyDocument];
    }
    return [[NSFileWrapper alloc] initDirectoryWithFileWrappers:[_fileWrapper fileWrappers]];
}

( WWDC 2012 Session 218 - iCloud UIDocument).

, : ?

- , fileWrappers ? , ?

+6
2

- writeContents:..., . saveToURL:forSaveOperation:completionHandler:. writeContents:... .

UIDocument - " UIDocument" (, UIDocument, - performAsynchronousFileAccessUsingBlock:).

UIDocument - Objective C - , , . , , , . , , UIDocument, NSFileWrapper contentsForType:error:. Wrappers NSDictionary.

NSFileWrapper . NSFileWrapper " UIDocument" readFromURL:error:, loadFromContents:ofType:error:. , .

, UIDocument , , , - updateChangeCount: (param is UIDocumentChangeDone). - , saveToURL:forSaveOperation:completionHandler:.

: UIDocument NSFilePresenter, NSFileCoordinator. UIDocument , . , , , , , . NSFilePresenter, (1) (2) / . UIDocument . NSFileCoordinator / .

+7

, , : , NSFileWrappers ( NSFileWrapper, ).).

, UIDocument . , , .

: _ NSFileWrapper fileAttributes (, , _), .

.

0

All Articles