I'm taking over a project I did not start and I'm still a junior, so I need some help to clarify my mind. I'm developing a library for iOS 7.0 and up. This library is then distributed trough cocoapods.
I've build a custom view and how I have a .xib file containing it. It works perfectly in my dev app (because I'm using directly the code), but when I test it in my staging app (which loads the library trough a local pod) I get
NSInternalInconsistencyException Could not load NIB in bundle: 'NSBundle </Users/Jack/Library/Developer/CoreSimulator/Devices/899B54FC-8A37-4182-9D89-109251B58555/data/Containers/Bundle/Application/36A3B225-AEF2-42B7-8AEC-5D930F4C4BCA/StagingApp.app> (loaded)' with name 'CheckBoxWithText''
The .xib file is in the copy file build phase and is part of the target I'm using to build the library.
I'm loading the xib like this
[[NSBundle mainBundle] loadNibNamed:@"CheckBoxWithText" owner:self options:nil];
But it crashes as soon as the components gets loaded on screen.
Some people were saying to use the bundle of your library, but I don't think my library has an identifier ( can't see it on info).
I tried using
[[NSBundle bundleWithIdentifier:@"com.company.project"] loadNibNamed:@"CheckBoxWithText" owner:self options:nil];
but it does not load anything.
I've spent the afternoon reading possible solution but now I've a lot of confusion in my head.
A static library (like mine) is not supposed to contain resources like xib, yet I'm packing some images with it. Am I missing something here?
I've read a tutorial about a guy who achieved this using a budle target, but I haven't really understood how he did it and how would I use that target given that I'm supposed to use my aggregate target to build the library.
A dynamic framework would solve the problem if not for the fact that I can't use it on iOS7.0.
Is my only option to build the layout programmatically?
Or am I just missing something and it's possible to pack the .xib file?