0

I am setting the owner viewcontroller in my model class component, which when clicked needs to present a DetailedViewController. The tap gesture code of model component looks like this:

DetailViewController *dvc = [[DetailViewController alloc] init];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
dvc = [storyboard instantiateViewControllerWithIdentifier:@"TileDetailView"];
dvc.infoRequest = self.data; // data to display
[dvc setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self.viewController presentViewController:dvc animated:YES completion:^{
        ;
    }];

'TileDetailView' is the id of detailedViewController in storyboard. Now when executing this code, i am getting the error mentioned below. On searching across web, i found that this kind of error appears when there is an owner error; however I am not able to identify the error here as The detailedViewController is initiated from Mainstoryboeard and is a valid identity here.

Any help/references are appreciated. Thanks.

Error trace:

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

*** First throw call stack:
(0x27d2012 0x1c0fe7e 0x285afb1 0x16bc711 0x163dec8 0x163d9b7 0x1668428 0xd740cc 0x1c23663 0x27cd45a 0xd72bcf 0xc37e37 0xc38418 0xc38648 0xc38882 0xc44235 0xe433d2 0xc414f3 0xc41777 0x46010 0xe2189a 0xe209db 0xe2211f 0xe24d6d 0xe24cec 0xe1ca68 0xb89fc2 0xb8a4a3 0xb683aa 0xb59cf8 0x2c9bdf9 0x2c9bad0 0x2747bf5 0x2747962 0x2778bb6 0x2777f44 0x2777e1b 0x2c9a7e3 0x2c9a668 0xb5765c 0x24ed 0x2415)
libc++abi.dylib: terminate called throwing an exception
SpaceDust__
  • 4,844
  • 4
  • 43
  • 82
user1242321
  • 1,578
  • 2
  • 18
  • 30
  • possible duplicate of [This class is not key value coding-compliant for the key](http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key) – jtbandes Aug 01 '15 at 21:57

1 Answers1

0

NSUnknownKeyException', reason: '[setValue:forUndefinedKey:]' usually indicates that you have an item set to multiple IBOutlets in your XIB file, or you are loading the wrong XIB file in your initWithNibFileName:. Each property on your view controller should correspond with an item in your XIB file. The Key/Value pairs of the XIB have to matchup with the properties in your XIB file.

Matt Hudson
  • 7,329
  • 5
  • 49
  • 66
  • yes you are correct. A reference of a mainstoryboard element was missing in DetailedViewController. adding the IBOutlet to DetailViewController fixed the issue for me. – user1242321 Dec 27 '12 at 15:43