So I have a view that I have put together in another .xib file. It also has it’s own .h/.m files.
I am trying to allocate an instance of it in my mainViewController and I keep getting:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<XXX 0x1c556390> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX
I am using the following code
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"SubviewClass"
owner:self
options:nil];
self.subview = (SubviewClass *)[nibViews objectAtIndex:0];
self.subview.frame = CGRectMake(82, 182, 155, 96);
[self.view addSubview:self.subview];
However it keeps crashing on the first line.
Your
SubviewClassnib has an object that is hooked up to an outlet that doesn’t exist. Check the connections for each object in your nib and check that the owner is correct and has the outlets that you are connecting to.