0

I am in need of loading a XIB file from a bundle. I am integrating with an external static library that shares with me a .bundle. Now, this .bundle has a XIB folder which contains MyView.xib file.

I am trying with below code:

NSBundle *frameworkBundle = [NSBundle bundleForClass:[self class]];
NSURL *fileURL = [frameworkBundle URLForResource: @"External" withExtension:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithURL:fileURL];

self = [self initWithNibName:@"MyView" bundle:bundle];

This code leads to crash.

During debug, I found that I get correct frameworkBundle handle and its loaded as well but while bundle handle is correct, I see a message "Not Loaded Yet" next to it.

Anyone have any idea as to how to tackle this?

Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • Is the "external static library" yours? As in, can you modify it if necessary? Not sure if this will solve it for your specific case, but probably worth a look: http://www.galloway.me.uk/tutorials/ios-library-with-resources/ – DonMag Mar 22 '17 at 13:09
  • Also this SO question (which is where I found the other link): http://stackoverflow.com/questions/17571366/how-to-add-xib-file-in-static-library-in-ios – DonMag Mar 22 '17 at 13:12
  • Yes, I have control on the static library. – Abhinav Mar 22 '17 at 13:12

0 Answers0