1

Unless done explicitly, is the only time a UIManagedDocument closed when the app is "quit"? By quit I mean when the user double taps the home button and holds onto the apps and closes them out.

I ask because right now I have my app in a tabBarController and I'm using the tabBarController to handle all the UIManagedDocuments since every other view controller has access to it via self.tabBarController. Right now my tabBarController will check if the UImanagedDocuments exist, are in a closed state, or are in an open state and deals with it accordingly to yield an open document ready to use. I'm doing this in viewWillAppear. I noticed that viewWillAppear for a tabBarController is only called once in the lifetime of the app before it is "quit". So I'm wondering if I need my other view controllers to check if the UIManagedDocuments they use are open before they use them or can I assume they will remain open until the app is "quit" if I don't explicitly close them anywhere in my code?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user1529956
  • 735
  • 2
  • 10
  • 24

1 Answers1

0

I have not seen this behavior where the UIManagedDocument closes when the application loses focus. I do believe you have to close the document explicitly if you want it closed. But to know for sure you can sign up for the UIDocumentStateChangedNotification and see exactly when it goes into a closed state.

dtrotzjr
  • 928
  • 5
  • 18