1

In my MainWindow.xib, I have a the following structure:

-Files Owner
-First Responder
-MyApp App Delegate
-Window
-Tab Bar Controller
--Tab Bar
--Selected Recipes Nav Controller (recipes) - The class is set to a subclass of UINavigationController
--Other tabs…

I have details view for editing which contains tabs for each of the sections which can be edited, so the structure looks like this:

-Files Owner
-First Responder
-Tab Bar Controller
--Tab Bar
--Selected View Controller (recipes) - The class is set to a subclass of UINavigationController
---Scroll View
----UITextField (txtName)
----UITextField (txtDescription)
--Other tabs…

When the user clicks the add toolbar button on the main navigation controller, I want to push this new view onto the stack, but I get an exception:

* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key txtName.'

I believe this could be caused by having two tab controllers. I've tried the following to show the new details view, but all throw the same exception:

MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
//[delegate.recipesNavController pushViewController:recipeDetailViewController animated:YES]; //- fails 
//[delegate.rootController presentModalViewController:recipeDetailViewController animated:YES]; //- fails
[self presentModalViewController:recipeDetailViewController animated:YES]; //- also fails

EDIT: I'm not so sure now, as replacing it with a UISegmentedControl results in a similar error:

this class is not key value coding-compliant for the key generalScroller.'

Echilon
  • 10,064
  • 33
  • 131
  • 217

3 Answers3

0

You should take a look at this, it seems to have helped here too.

Community
  • 1
  • 1
Deepak Danduprolu
  • 44,595
  • 12
  • 101
  • 105
0

The iOS error messages are usually pretty to-the-point: what class is it saying is not KV compliant? Somewhere you're setting up a KVO with txName and/or generalScroller and something is either not listening for those or is listening for a mis-spelled key name.

Rayfleck
  • 12,116
  • 8
  • 48
  • 74
0

The problem was I was declaring the view controller incorrectly. I was using:

RecipeDetailViewController *dvController = [[RecipeDetailViewController alloc] initWithNibName:@"RecipeDetailEditView" bundle:nil];

When I needed:

RecipeDetailEditViewController *dvController = [[RecipeDetailEditViewController alloc] initWithNibName:@"RecipeDetailEditView" bundle:nil];
Echilon
  • 10,064
  • 33
  • 131
  • 217