0

空の値を持つコントローラーから戻った後にアラートがポップアップするプロジェクトに取り組んでいます。シミュレーターではポップアップしますが、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];
         }
     }
4

2 に答える 2

2

あなたはこの質問を見る必要があります多分それは役立つでしょう:

uialertviewはリリースモードでクラッシュを引き起こします

于 2009-12-16T20:45:49.333 に答える
2

あなたのotherButtonTitles議論はゼロで終わる必要があります。

一般に、可変数の引数を取るメソッドは、最後にnilを付ける必要があります。例えば:

[NSArray arrayWithObjects:objA, objB, nil];

そしてあなたの場合:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:@"message" delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:@"otherbutton", nil];
于 2009-12-16T20:50:55.610 に答える