Not having used Core Data on the Xcode simulator before I am curious as to why execution seems to stop at the following line (See below). This works just fine on the device but on the simulator [[self managedDocument] documentState] returns (null). I would suspect that this is because the simulator uses the Mac and is not creating the database on disk, but I just wanted to check to make sure that something is not happening that I am missing when running on the actual device.
if([[self managedDocument] documentState] == UIDocumentStateNormal) {
[self scanDataFromServer:kALL_REACTOR_TEMPS];
}
NOTE:
I don’t need to run on the simulator, I just wanted to check how the application ran with the larger iPhone5 screen whilst Apple get round to shipping the actual device to me.
ALSO:
- The simulator is set to retina 4-inch, the device I am using is an
iPhone4. - The application first creates and populates Core Data, so
its not a case of a missing file.
First off,
UIDocumentStateis an NSInteger enum — it can never be nil or null. It can be uninitialized (garbage) or it can be zero.I am not sure what you mean by this:
The simulator uses the computer’s hard drive as it’s disk and the storage system is no different between the simulator and the device. Of course your application has a different root folder path on the simulator than it does on the device, but that doesn’t matter. You can find the database file within your apps folder on your mac, which will be somewhere in
~/Library/Application Support/iPhone Simulator/.I would double check your
UIDocumentafter it is created and make sure it is notnil. Also, log thefileURLof the document and locate that file on your computer to make sure it exists.