When a UIDocument is closed, can it close again? Even when it's documentState is UIDocumentStateNormal after reopened?
Please help me. Thanks a lot!
[document openWithCompletionHandler:^(BOOL success) {
if (success) {
[document closeWithCompletionHandler:^(BOOL success) {
if (success) {
[document openWithCompletionHandler:^(BOOL success) {
if (success) {
NSLog(@"%d", document.documentState);
//Exception
[document closeWithCompletionHandler:^(BOOL success) {
if (success) {
}
}];
}
}];
}
}];
}
}];
When closeWithCompletionHandler called at the "Exception" mark, an exception is thrown:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'closeWithCompletionHandler called while document is already closing'
Notice that you are still inside the first closeWithCompletionHandler
method when you call the second. By reading the exception that seems to be the cause.