title: Why can't I load a nib in my bundle in my iPhone static library?
body: <p>Let me preface this by saying that I'm a <em>very</em> raw iPhone developer.</p>
  
  <p>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 <code>UIViewController</code> using the xib in question.</p>
  
  <p>I have the following code in my library:</p>
  
  <pre><code>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];
  </code></pre>
  
  <p>The bundle path outputted by <code>NSLog</code> is the correct path for the bundle in the compiled app. Unfortunately, I cannot initialize the <code>UIViewController</code> and instead get the following error:</p>
  
  <pre><code>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"'
  </code></pre>
  
  <p>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?</p>