Sheehan Alam
Sheehan Alam

Reputation: 60869

Error when switching views in UITabBarController

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 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.

Upvotes: 0

Views: 115

Answers (2)

ms83
ms83

Reputation: 1814

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.

Upvotes: 0

superjessi
superjessi

Reputation: 1790

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.

Upvotes: 1

Related Questions