启用僵尸对象后,当我尝试编辑 UITextField (textLvl) 时,我能够看到以下错误:
2013-01-13 13:27:10.509 testob[18418:907] *** -[NSConcreteMutableAttributedString
_UIKBStringWideAttributeValueForKey:]: message sent to deallocated instance 0x2066a1f0
我已经发布了导致以下问题的代码部分,它似乎特别是“textField.text = self.storeText;” 部分-当我对此发表评论时,问题就消失了。
您可能会说我不是最有经验的 iOS 开发人员,为什么我的 UITextView 在设置文本后会释放?请帮忙!
另外,我以前从未听说过“_UIKBStringWideAttributeValueForKey”——有什么想法吗?
谢谢大家!
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(@"Text began editing");
self.storeText = textField.text;
textField.text = @"";
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
if (textField == textLvl){
if ([textField.text isEqualToString:@""]){
textField.text = self.storeText;
NSLog(@"No Text");
}
self.conv = [textField.text intValue];
if (self.conv >= 101){
textField.text = @"100";
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:@"Oh no!" message:@"Can't be higher than 100." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[successAlert show]; }
}}