当我尝试为UItextfield分配文本时,它使我的应用程序崩溃。 这里是图像: 信号SIGABRT尝试为uitextfield分配文本时出错
但是当我评论的代码行:txtExpire.text = posCustomer.CCExpire;
和txtExpire.text = posSupplier.CCExpire;
我的应用程序工作正常。请帮我找出根本原因。
这里是我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
@synchronized (self){
if (posCustomer) {
txtAccountLimit.text = [NSString stringWithFormat:@"%d",[posCustomer.AccountLimit intValue]];
txtBSB.text = posCustomer.BankBSB;
txtAccount.text = posCustomer.BankAccount;
txtNotes.text = posCustomer.BankNotes;
txtCreditCardNo.text = posCustomer.CCNumber;
txtNameOnCard.text = posCustomer.CCName;
txtExpire.text = posCustomer.CCExpire;
}else if (posSupplier){
txtAccountLimit.text = [NSString stringWithFormat:@"%d",[posSupplier.AccountLimit intValue]];
txtBSB.text = posSupplier.BankBSB;
txtAccount.text = posSupplier.BankAccount;
txtNotes.text = posSupplier.BankNotes;
txtCreditCardNo.text = posSupplier.CCNumber;
txtNameOnCard.text = posSupplier.CCName;
txtExpire.text = posSupplier.CCExpire;
}
}
}
打开没有。 – damirstuhec
也许你正在为'posCustomer.CCExpire'获得'nil'值。 –
数据类型不匹配或分配 – codercat