Let me preface this by saying that I'm a very raw iPhone developer.
I'm making a static library that can be used in iPhone apps. It needs to show a view but static libraries, as I understand it, cannot include nibs (or xibs, in my case). So, I have created a separate bundle containing the xib I need. I then include the bundle along with the static library in the app. I want to initialize a class that extends UIViewController using the xib in question.
I have the following code in my library:
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"Mobtest" ofType:@"bundle"];
NSBundle *mobtestBundle = [NSBundle bundleWithPath:bundlePath];
NSLog([@"bundle path: " stringByAppendingString: [[NSBundle bundleWithPath:bundlePath] bundlePath]]);
sharedInstance = [[MTFeedbackViewController alloc] initWithNibName:@"MTFeedbackViewController" bundle:mobtestBundle];
The bundle path outputted by NSLog is the correct path for the bundle in the compiled app. Unfortunately, I cannot initialize the UIViewController and instead get the following error:
2010-08-20 22:08:16.102 MobtestLibSampleApp[2332:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "MTFeedbackViewController"'
Does anyone have any suggestions of why the xib cannot be loaded? Perhaps something in it is linked incorrectly? Is there any place where I can get additional debugging information?