Recently, I'm working with a timetable app in iOS, and i get trouble with Core Data.
My app has a main user interface kind of like the original calendar app created by Apple, and i save all my events data in the Core Data database.
I create a UIManagedDocument in order to fetch data from database by using its NSManagedObjectContext, and everything works just fine.
However, i need to use the NSManagedObjectContext to fetch data several times in several different view controllers during the runtime. And every time i do this, i need to reopen the UIManagedDocument, but open the document take too much time(it may take 2 seconds or even more, i have to display a spinner in view).
So here are my questions:
- What's the right way to open a managedDocument?(I mean like open it during the lunch image time?)
- Is there a way to only open the managedDocument once and keep it open during runtime?(So i can use its context all the time)
- Does data store in the managedDocument i create?(I found that if i delete the document, data was gone)
Thanks.