EXC_BAD_ACCESS iPhone Development

Posted by gkres121 on Stack Overflow See other posts from Stack Overflow or by gkres121
Published on 2012-04-12T05:26:57Z Indexed on 2012/04/12 5:28 UTC
Read the original article Hit count: 130

Filed under:
|
|

Sorry, this could be a simple fix, as I am new to iPhone Development.

In my Delegate, after pressing the create profile button, the create profile view is pushed:

-(void) createProfile_clicked:(id)sender {

AddNewProfile *create = [[AddNewProfile alloc] init]; 


[self.window addSubview:create.view];

[self invisibleCreateProfileBar];


AddNewProfile *controller = [[AddNewProfile alloc] initWithNibName:@"AddNewProfile" bundle:[NSBundle mainBundle]];
[ self.navigationController pushViewController:controller animated:YES ];

currentController=controller;

}

Then in the AddNewProfile.m:

- (IBAction)backgroundTap:(id)sender {
if([nameField isFirstResponder]){
    [nameField resignFirstResponder];
}

if([ageField isFirstResponder]){
    [ageField resignFirstResponder];
}

if([doctorNameField isFirstResponder]){
    [doctorNameField isFirstResponder];
}

if([doctorNumberField isFirstResponder]){
    [doctorNumberField resignFirstResponder];
}

}

This leads to a exc_bad_access error every time the FirstResponder is ever messed with, with any of my controls. I can select a control(text box), but once I click out of one, it crashes.

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ios