Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Problems loading nib files after class is split into a static library.

I've recently split a project so that the common re-usable controls are in their own class library. My original application project now references these using a cross project reference.

However, since I have split the projects up, my original project crashes when it loads main.xib because it cannot find one of the custom classes which is defined in the library project.

When I first split up the projects, I noticed that there were problems with the nib files not being able to find the IB outlets of the custom classes, but I managed to get around these by going importing the relevant library class files manually (File > Read Class Files…).

I have made sure that all of the nib files compile without warning, so as far as I can tell, Interface Builder is able to read the necessary class headers, but when I try to run the app, it crashes saying that there is an unknown class in the Interface Builder file and that the class is not coding compliant.

Are there any steps I've missed or advice on how to troubleshoot this?

MacBook Pro, iOS 4

Posted on Feb 24, 2011 2:58 AM

Reply
2 replies

Feb 25, 2011 3:22 AM in response to m_userName

I did a bit of digging. The reason why this wasn't working is because the class in question was referenced by the nib files, but not in code. Therefore, while the code compiled and there were no warnings with the nib files, the linker was not linking the classes because no code used them directly.

This can be fixed by going to the Project Settings, and on the Build tab, underneath the Linking heading, adding -ObjC to the Other Linker Flags section.

Problems loading nib files after class is split into a static library.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.