Reputation: 65
Firstly I have inspected all of the other questions on this topic: the answers provided seem to be:
My code is compiled to a static library, and I export the .a file and xib file. My example app that uses it includes the xib in its bundle ("copy bundle resources" in build phase)
In my library code I have a function in a separate UIViewContoller subclass to create the view controller from the nib:
- (void) presentCustomController
{
self.vCtrl = [[CustomController alloc] initWithNibName:@"CustomController" bundle:nil];
...
}
When I run the example app, I inspect the _view member of self.vCtrl, and it is 0x0000, and of course this is what causes the exception in the posting title. My understanding was that the view to which that member points was 'auto generated' from the xib file, and it's children were the controls that I have put in it (buttons etc). What part of my understanding has fallen down? Is the problem related to the fact that it is in a static library? Thanks for any help.
Upvotes: 3
Views: 10014
Reputation: 2575
If you are 100% that you connected your View to the File's Owner then I suggest you do the following:
cmd+shift+K
) or Clean Build Folder if you prefer (cmd+shift+alt+K
)That should fix it hopefully.
Upvotes: 8
Reputation: 38213
Do you have multiple targets?
- make sure you set the file's owner to your custom view controller class (which I have done)
I have come across a similar issue where I thought that I was setting the file's owner's custom class, however, IB was not actually setting it. Open the XIB as its raw xml and search for the custom class name.
For me it was because the .m of the view controller was not included for my specific target. To fix this check all the boxes in the target membership pane.
Upvotes: 2