我的iOS应用在UIDocument.revert(toContentsOf url: URL,
completionHandler: ((Bool) -> Void)? = nil)
的生产环境中崩溃。从错误消息看,好像该文档应该被还原到其自身。例如:
**** Terminating app due to uncaught exception
'NSInternalInconsistencyException',
reason: 'attempt to revert document at URL (
file:///private/var/mobile/Library/Mobile%20Documents/
iCloud~com~myapp/Documents/sampledocument.test)
to URL (
file:///private/var/mobile/Library/Mobile%20Documents/
iCloud~com~myapp/Documents/sampledocument.test)
that is not yet open'
我没有任何用于还原文档版本的特定代码,我也无法自己复制该版本,但是许多用户都遇到了这种情况。
在什么情况下UIDocument会尝试还原其内容,为什么会尝试将同一文件还原为其自身?
这可能是关闭文档但出于某种原因试图放弃更改的竞争条件吗?