0
votes

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.

1

1 Answers

0
votes

I just saw in the Apple Developer web site that

In UIKit, applications can load nib files only from their main bundle and so fewer options are needed. But I want to know if there is any other alternatives.