UIDocument在revertToContentsOfURL:completionHandler:上崩溃,并带有“试图还原尚未打开的文档”

时间:2019-05-04 15:13:19

标签: ios uidocument

我的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会尝试还原其内容,为什么会尝试将同一文件还原为其自身?

这可能是关闭文档但出于某种原因试图放弃更改的竞争条件吗?

0 个答案:

没有答案