Search code examples
iosxcode4

EXEC_BAD_ACESS for retained object


I am using xCode 4.3 and this is weird. I have properly initialized my UITextfield but when i call it in IBAction it gives me EXEC_BAD_ACCESS>

in .h File
interface .........
{
IBOutlet UITextField * usernameField;
}
@property(nonatomic,retain) UITextField * usernameField;

in .m File

@implementaion ............

@synthesize usernameField;

- (IBAction) editingEnded:(id)sender
{

    [usernameField resignFirstResponder];
}

Solution

  • I think your property should have iboutlet on it to.

    @property(nonatomic,retain) IBOutlet UITextField * usernameField;
    

    does that solve the problem?