Andrew Park
Andrew Park

Reputation: 1489

EXC_BAD_ACCESS in UITextField while typing

I created a brand new view-based project and added into the viewDidLoad

- (void)viewDidLoad
{
    [super viewDidLoad];
    myField = [[UITextField alloc] initWithFrame:CGRectMake(50, 50, 150, 31)];
    myField.delegate=self;
    [self.view addSubview:myField];
    [myField release];
}

my header file is

@interface textfieldpracticeViewController : UIViewController<UITextFieldDelegate>{
UITextField *myField;
}

when i click in the textfield and the keyboard pops up, i start typing but on the 2nd character, i get the exc_bad_access error. I ran it with NSZombieEnabled, NSDebugEnabled, MallocStackLoggin, and MallocStackNoCompact but they weren't able to catch the error.

This fails when using the iphone 4.3 simulator, but works fine when i build it on my iphone. is this an xcode error or am i missing something?

Thanks

P.S. even tried property/synthesize out of desparation

Upvotes: 6

Views: 3086

Answers (1)

omz
omz

Reputation: 53561

Try disabling autocorrection in the simulator's keyboard settings. This seems to be a bug in the autocorrection system of the simulator's iOS.

Upvotes: 22

Related Questions