I have created a resource bundle using CocoPad which contains localized strings, images and xib files. I have no problem loading localized strings and images but I am having problem loading xib files using a similar approach. Here is One of the methods I tried:
NSString *nibName = @"MyTestViewController";
NSBundle *resourceBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"MyTestResources" withExtension:@"bundle"]];
NSString* path= [resourceBundle pathForResource:@"en" ofType:@"lproj"];
NSBundle* nibBundle = [NSBundle bundleWithPath:path];
return [[MyTestViewController alloc] initWithNibName:nibName bundle:nibBundle];
I got 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (not yet loaded)' with name
I have printed out the files in the nibBundle and the file is there.