Can't find momd file: Core Data problems

Posted by thekevinscott on Stack Overflow See other posts from Stack Overflow or by thekevinscott
Published on 2010-12-27T03:13:08Z Indexed on 2010/12/27 4:53 UTC
Read the original article Hit count: 235

Filed under:
|
|
|
|

Aw geez! I screwed something up!

I'm a Core Data noob, working on my first iOS app. After much Stack Overflowing I'm using this code:

NSString *path = [[NSBundle mainBundle] pathForResource:@"CoreData" ofType:@"momd"];
if (!path) {
    path = [[NSBundle mainBundle] pathForResource:@"CoreData" ofType:@"mom"];
}
NSAssert(path != nil, @"Unable to find Resource in main bundle");

CoreData is the name of my app.

I've tried to put in initial data into the app by finding the path to the sqlite file in my iPhone simulator, and then going and inserting into that sqlite file. But at some point, I moved the sqlite (thinking it would create a fresh copy), deleted the app from the simulator, and the sqlite file is gone. I'm not sure if I'm leaving out some part of the process (this was a few hours ago) but the end result is that everything is screwed up.

How do I resubstantiate this sqlite / momd file? "Clean" and "Clean all targets" are grayed out.

I'm happy to post the relevant code from my app that would help shed some light on this problem but there's tons of code relating to Core Data which I don't understand, so I'm not sure what part to post! Any help is greatly appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c