2014-02-20 65 views
0

我想在本地保存一个UIDocument(用于当用户的iCloud关闭)。这被证明是一个挑战。每次我尝试保存它时,保存都会失败。我可以访问哪些错误?有没有人知道为什么会失败?谢谢!保存UIDocument本地

+0

是什么UIDocument和UIManagedDocument之间的区别? –

+0

这里,看看这个http://stackoverflow.com/questions/11933055/uidocument-openwithcompletionhandler-crash,也是一个教程来检查你的工作流程http://www.raywenderlich.com/12779/icloud-and-uidocument-beyond-在-基础知识部分-1 – DogCoffee

回答

0

从上UIDocument文档:

- (void)handleError:(NSError *)error userInteractionPermitted:(BOOL)userInteractionPermitted 

This method is called by the default implementations of openWithCompletionHandler: and saveToURL:forSaveOperation:completionHandler: when UIDocument encounters a reading or writing error, respectively.`

如果实施此方法,你应该能够检查NSError在那里,以确定故障的原因。

+0

我现在用的是saveToURL方法,它调用你所提到的方法。这种方法没有任何错误信息,但是 –

+0

@ClintWarner:看的HandleError:userInteractionPermitted:为UIDocument的文件中。回答编辑。 –