iPhone:UIAlertView中工作在模拟器,但使iPhone上的应用程序冻结
-
20-09-2019 - |
题
我真的工作的一个项目,其中的警报应来自控制器返回一个空值之后弹出。它弹出在模拟器,但在iPhone上从控制器返回时,应用程序冻结并退出。有任何想法吗?
下面是我的代码:
- (void)manualBarcodeViewControllerDidFinish:(ManualBarcodeViewController *)controller
{
......
......
else if([barcode isEqualToString:@""])
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton"];
[alert show];
[alert release];
}
}
解决方案
您otherButtonTitles
参数需要是零终止的。
在一般情况下,采用可变数目的参数的方法,需要在端部具有零。例如:
[NSArray arrayWithObjects:objA, objB, nil];
和你的情况:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton", nil];
其他提示
你应该看看这个问题,也许这将有助于:
不隶属于 StackOverflow