I have a UITabBarController that has 3 tabs. Each tab contains a UITableViewController. When I add a subview to one of the UITableView's and then switch to another tab I get the error:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<MessageTableViewController 0x703f6b0> setValue:forUndefinedKey:]: this class is not key
value coding-compliant for the key emptyView.'
emptyView is the subview that I added. I am not sure why the new view that is being switched to requires emptyView?
UPDATE: I am开发者_StackOverflow中文版 adding to emptyView by:
[self.view addSubview:emptyView];
in my viewDidAppear method.
MessageTableViewController is the rootview for the tab I am navigating to.
I am also noticing that no matter which tab I navigate to, I get this error. emptyView is only in the NIB for 1 of my VC's. Not all three. Each tab has its own unique VC.
This is a common error received when you have changed or deleted a property from that class, and did not update the connections in Interface Builder. It also happens when your File's Owner does not have the correct class identified.
You may want to try checking both of these items in Interface Builder, to see if either are creating this error.
Try checking to see if the class is set correctly in Interface Builder identity inspector. You will then want to look under the custom class heading to see if that objects class is set correctly.
精彩评论