EXC_BAD_ACCESS in UITextField while typing

不问归期 提交于 2019-12-30 08:53:06

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/6990419/exc-bad-access-in-uitextfield-while-typing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!