UITextField exc_bad_access solution

来源:互联网 发布:java log4j的使用 编辑:程序博客网 时间:2024/06/07 06:30

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

 

 

 

the solution:

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

 

原创粉丝点击