iphone:UIAlertViewは、シミュレータで動作しますが、iPhone上でアプリがフリーズします
-
20-09-2019 - |
質問
アラートが空の値を持つコントローラから戻った後にポップアップ表示すべきプロジェクトに取り組んで
I`m。これは、シミュレータでポップアップしないが、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
引数がnilを終端する必要があります。
一般的には、可変個の引数を取る方法は、最後にnilを持っている必要があります。たとえばます:
[NSArray arrayWithObjects:objA, objB, nil];
とあなたのケースでます:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton", nil];
他のヒント
あなたは多分それは助けるこの質問を見てする必要があります:
リリースモードのでクラッシュします所属していません StackOverflow