2

重複の可能性:
UIAlertview のボタンをクリックした直後に iOS アプリがクラッシュした

ユーザーが UIAlertview のボタンをクリックした後、電話アプリで番号をダイヤルしようとしました。電話アプリは開きましたが、元のアプリは UIAlertview のボタンをクリックした直後にクラッシュしました。理由を知っている人はいますか?リリースすべきものはすべてリリースするようにしました。エラーは 0x3beb85b0: ldr r3, [r4, #8] EXC_BAD_ACCESS (code=1, address=0x7269634f) です。ありがとう!以下はコードです:

    -(IBAction)dialButtonPressed:(UIButton *)numberButton
            {
            if ([company isEqualToString:@"Not Found"]==true){
                    message = [[UIAlertView alloc] initWithTitle:@"Sorry"
                                                                      message:@"No replace number found. Would you like to dial anyway?"
                                                                     delegate:self
                                                            cancelButtonTitle:@"No"
                                                            otherButtonTitles:@"Yes", nil];
                    message.tag = 1;
                    if(phoneLinkString)
                    {
                        [phoneLinkString release];
                        phoneLinkString = nil;
                    }
                    [message show];
                    [message autorelease];
                    phoneLinkString = [[NSString stringWithFormat:@"tel:%@",replace]retain];


                }
        }
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
        {

            if(message.tag == 1 && buttonIndex == 1){

                NSURL *phoneLinkURL = [NSURL URLWithString:phoneLinkString];
                [[UIApplication sharedApplication] openURL:phoneLinkURL];
                message = nil;
            }
        }
- (void)dealloc {
            [phoneNumberString release];
            [phoneNumberLabel release];
            [super dealloc];
        }
4

1 に答える 1

0

didDismissWithButtonIndex の代わりに試していただけますかclickedButtonAtIndex。私は私に知らせていると思います。

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; 
于 2012-11-16T14:55:35.030 に答える