似乎是一个令人震惊的微不足道的差异。将 otherButtonTitles
的非 nil
值传递给 UIAlerView
会爆炸。
工作:
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Login with your credentials"
message:nil
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
不工作:
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Login with your credentials"
message:nil
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK"];
什么给了?
最佳答案
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Login with your credentials"
message:nil
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK1",@"OK2",nil];
最后一个参数是一个多参数,应该以 nil 结尾。
关于iOS/ cocoa : UIAlertView throwing EXC_BAD_ACCESS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11910539/