2014-02-20 58 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的文件中。回答編輯。 –