Error loading my managedObjectModel

Posted by niklassaers on Stack Overflow See other posts from Stack Overflow or by niklassaers
Published on 2010-04-30T19:42:54Z Indexed on 2010/04/30 19:47 UTC
Read the original article Hit count: 357

Filed under:
|
|

Hi guys,

When I call [myAppDelegate managedObjectModel], in the retain line below, my application will crash (iPhone SDK v3.1.3):

- (NSManagedObjectModel *)managedObjectModel {

    if (managedObjectModel != nil) {
        return managedObjectModel;
    }
    managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];    
    return managedObjectModel;
}

Here is my crash trace

#0  0x905c44e6 in objc_exception_throw
#1  0x01e78c3b in +[NSException raise:format:arguments:]
#2  0x01e78b9a in +[NSException raise:format:]
#3  0x000af99b in _NSArrayRaiseInsertNilException
#4  0x0001c360 in -[NSCFArray insertObject:atIndex:]
#5  0x0001c274 in -[NSCFArray addObject:]
#6  0x01c16a7e in +[NSManagedObjectModel mergedModelFromBundles:]
#7  0x00002432 in -[myAppDelegate managedObjectModel] at myAppDelegate.m:102

What is going on here? This is template code that I haven't seen fail before.

Cheers

Nik

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about cocoa-touch