gpt4 book ai didi

objective-c - iOS 应用程序在单击 UIAlertview 后立即崩溃

转载 作者:行者123 更新时间:2023-12-01 16:54:04 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




9年前关闭。




Possible Duplicate:
The iOS app crashed right after clicking the button on a UIAlertview



在用户单击 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];
}

最佳答案

你能试试didDismissWithButtonIndex而不是 clickedButtonAtIndex .我猜让我知道。

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; 

关于objective-c - iOS 应用程序在单击 UIAlertview 后立即崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13418854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com