I am using core data with preloaded sqlite database. I am encountering a strange issue, the app works on the simulator, but when I try run it on a device, e.g. iPad, I get the error below.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject persistentStore]: unrecognized selector sent to instance 0x3bebf50'
I recreated the sqlite database from the model and repopulated the database, but I still get the same error. I’ve checked the ‘Compiled Sources’ and ‘Copy Bundle Resources’ in the build phase section and the files are all there.
Code:
http://pastebin.com/fTTgEA3W
Been racking my brain and can’t seem to understand why it’s not working, any help would really be appreciate.
Thank you for your time and if you need any more information please let me know.
First measure: delete the app and reinstall.
Second measure: text search for a call to
persistentStorein your code. It is apparently going to an address that is aNSManagedObjectContextwhich does not have this method. Fix the error if you find it.Third measure: review your recreation algorithms to make sure you are building the store correctly. In my projects with big stores, I usually have a
SETUPflag that I switch on if the store needs to be imported from raw data, which normally works only in the simulator because of the memory needs. (WhenSETUPis off and there is no store, the one generated previously is copied over.) Maybe on the iPad you do not have enough memory to do the data import.