0
votes

I try to add CoreData in my SDK project, but

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"LSCmsModel" withExtension:@"momd"];

always returns nil. I think it connected with differences in path for SDK and project which uses this SDK. But how to resolve it?

1
delete your LSCmsModel file and create new file then try it. - balkaran singh
Have you tried it in Framework development? It doesn't work in my case :( - Konstantin.Efimenko

1 Answers

1
votes

When you call [NSBundle mainBundle], you get the app bundle. If you're developing a framework, that's not the framework bundle, so it won't find files in the framework.

Within a framework, you need to use either bundleWithIdentifier: or bundleForClass: to look up the framework bundle.