magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.79k stars 1.79k forks source link

Following documentation in Readme doesn't seem to setup core data correctly #55

Closed aussiegeek closed 13 years ago

aussiegeek commented 13 years ago

I followed the instructions in the readme, but get an exception "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Product'" as soon as I try and send createEntity.

A sample project is at https://github.com/aussiegeek/MagicalRecordTest

casademora commented 13 years ago

So, I downloaded your project, it looks like you're not using one of the setup methods to initialize the core data stack:

[MagicalRecordHelpers setupCoreDataStack];

I put this method call before your call to createData, and the app worked.

I think there is a line in the docs that say that the Core Data stack should be created for you, but this doesn't seem to be the case.

Also, I recommend against cleaning up the stack on background or resign active because your app can potentially still be running, and using data from core data. Cleanup is for unit testing and application termination.

I hope this helps get you going, I'm going to have a more complete sample app in the project sometime soon (within the next month).

Cheers,

Saul

Saul Mora saul@casademora.com (mailto:saul@casademora.com) http://about.me/saulmora

On Sunday, July 31, 2011 at 6:21 AM, aussiegeek wrote:

I followed the instructions in the readme, but get an exception "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Product'" as soon as I try and send createEntity.

A sample project is at https://github.com/aussiegeek/MagicalRecordTest

Reply to this email directly or view it on GitHub: https://github.com/magicalpanda/MagicalRecord/issues/55

aussiegeek commented 13 years ago

Thanks Saul,

All up and running smoothly now.

Also noticed you had code to generate an NSFetchedResultsController, wow that is much simpler!

On 01/08/2011, at 1:51 AM, casademora wrote:

So, I downloaded your project, it looks like you're not using one of the setup methods to initialize the core data stack:

[MagicalRecordHelpers setupCoreDataStack];

I put this method call before your call to createData, and the app worked.

I think there is a line in the docs that say that the Core Data stack should be created for you, but this doesn't seem to be the case.

Also, I recommend against cleaning up the stack on background or resign active because your app can potentially still be running, and using data from core data. Cleanup is for unit testing and application termination.

I hope this helps get you going, I'm going to have a more complete sample app in the project sometime soon (within the next month).

Cheers,

Saul

Saul Mora saul@casademora.com (mailto:saul@casademora.com) http://about.me/saulmora

On Sunday, July 31, 2011 at 6:21 AM, aussiegeek wrote:

I followed the instructions in the readme, but get an exception "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Product'" as soon as I try and send createEntity.

A sample project is at https://github.com/aussiegeek/MagicalRecordTest

Reply to this email directly or view it on GitHub: https://github.com/magicalpanda/MagicalRecord/issues/55

Reply to this email directly or view it on GitHub: https://github.com/magicalpanda/MagicalRecord/issues/55#issuecomment-1695440

Alan Harper 0457 090 366 Skype: alanbharper