NSManagedObjectModel initWithContentsOfURL returns nil eventhough the modelURL is valid
my NSManagedObjectModel is returning nil eventhough the path is correct. NSString *modelKey = [NSString stringWithFormat:@"/%@/Model", name]; NSString *modelPath = [((Configuration *)[Configuration shared]) stringEntry:modelKey]; NSURL *modelURL = nil; if ( ! [modelPath contains:@"://"] ) { modelPath = PathForBundleResource( modelPath ); modelURL = [NSURL fileURLWithPath:modelPath]; } NSManagedObjectModel *m = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; NSString *PathForBundleResource(NSString *relativePath) NSString* resourcePath = [[NSBundle mainBundle] resourcePath];