ポップアップ アラートの表示を練習するためだけに非常に単純な iOS アプリケーションを実装していますが、アラート ボタンを押すとエラーが発生します。
スレッド 1:EXC_BAD_ACCESS(コード=1、アドレス=0x676f6f57)
これはコードです:
- (IBAction)AlertButton {
alert = [[UIAlertView alloc]
initWithTitle:@"Alert" message:@"Alert"
delegate:self
cancelButtonTitle:@"Dismiss"
otherButtonTitles:@"Apple", "Google" ,nil];
[alert show];}
-(void)alertView :(UIAlertView *)alertView clickedButttonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1){
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://apple.com"]];
}
if(buttonIndex == 2){
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://google.com"]];
}}