开发者

Multiview application crash

I made a multiview based application. My app has 3 views. The first is a disclaimer notice. When the user agrees it takes them to the main menu. From there, if they click a button, they will be taken to the respective views. One view is where the user can enter values (upon which a calculation is done). When I click the button to go to that view my app crashes and the following code gets highlighted. I followed this video tutorial.

 [self presentModalViewController:second animated:YES]; along with the program received a SIGABRT message ! 

Checking the debugger showed me the following message: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<gainview 0x6a10d10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the ke开发者_StackOverflowy label1.'

This is my full code:

code in the disclaimer view

-(IBAction)switchtoview2:(id)sender{

    secondview *second = [[secondview alloc]initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES];
}

code in the main menu (i get the error when pressing the button in this view)

-(IBAction)swichtogain:(id)sender{
    gainview *second = [[gainview alloc]initWithNibName:nil bundle:nil];
    [self presentModalViewController:second animated:YES]; //debugger highlights this line !     
}

When hitting the button it is supposed to go to another view where I have few buttons: UItextfields and few pickers.


Highly likely, you have a problem with one of your nib files, or a mismatch between nib definition and your classes.

In the nib associated to the controller that you are trying to show modally, check:

  1. that all connections among outlets and objects are correct;

  2. that the class identity of you nib objects is the one you expect to be (specifically for your controller/file's owner);

  3. that your Objective C classes have all their IBOutlets defined.

If you need more help, you should post some more code...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜