0

This is my first interface using a button to call another xib interface

-(IBAction)poli

UIViewController *ll = [[UIViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[self presentModalViewController:ll animated:YES];

and second interface calling the previous one ....

-(IBAction)popaa

UIViewController *ui = [[UIViewController alloc] initWithNibName:@"Ra" bundle:nil];
[self presentModalViewController:ui animated:YES];

but there occurs a problem that shows

terminating app due to uncaught exception 'NSUnknownKeyException', reason: [<UIViewController 0x7433230> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pol

could someone explain the problem, i just want the first xib to show the second and second to show the first xib via a button.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
Ramiz Girach
  • 169
  • 2
  • 10
  • 1
    check your interface builder outlet connections – Midhun MP Dec 04 '12 at 04:31
  • Have you checked your xib, all connections are present? More-over, why you're presenting modal view controller, if you want to pop, then just use: [self.navigationController popViewControllerAnimated:YES] – Mohit_Jaiswal Dec 04 '12 at 04:33
  • 1
    Are you presenting the second controller from the first, and then presenting the first from the second? If so, this is not the way to do it. After presenting the second, you use dismissViewControllerAnimated: to dismiss the second controller, which takes you back to the first.' – rdelmar Dec 04 '12 at 04:35
  • @Mohit_Jaiswal: he is not using navigation controller. He is presenting view using present modal view controller – Midhun MP Dec 04 '12 at 04:35
  • possible duplicate of [this class is not key value coding-compliant for the key view](http://stackoverflow.com/questions/10152872/this-class-is-not-key-value-coding-compliant-for-the-key-view) – Midhun MP Dec 04 '12 at 04:36
  • @delmar i think your suggestion is good – Ramiz Girach Dec 04 '12 at 04:38

1 Answers1

1

Check if your xibs has any warning. Usually setValue:forUndefinedKey: is thrown when you have added some view in xib but the same is not added to your class code or the outlet is not defined properly. In this case you have added some view pol to your xib but the same is not present in your ll or ui class.

Also your dismiss method should be,

- (IBAction)popaa

  [self dismissViewControllerAnimated:YES];
}
iDev
  • 23,310
  • 7
  • 60
  • 85