從第一個警報的按鈕執行第二個警報,這基本上是一個確認來打電話給某人。我沒有得到任何錯誤,但它不起作用。
當我按下第二警報呼叫按鈕,它崩潰AlertView裏面的alertView
-(void) alertView: (UIAlertView *) alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *buttonString = [alertView buttonTitleAtIndex:buttonIndex];
if ([buttonString isEqualToString:@"Phone"])
{
UIAlertView *alert2 = [[UIAlertView alloc] initWithTitle:@"Notice!" message:@"You are about to call .... Do you wish to continue?" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Call", nil];
[alert2 show];
if ([buttonString isEqualToString:@"Call"]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://12345678"]]];
}
if([buttonString isEqualToString:@"Website"]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"website"]];
}
if ([buttonString isEqualToString:@"Facebook"]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.facebook.com/groups/..../"]];
}
}
}
現在它會立即調用,而不會彈出第二個提醒。我嘗試了5秒..我的方式,它確實帶來了第二次警報,但沒有執行電話.. – snksnk 2012-07-30 12:00:52
好吧,你試過,如果該電話甚至工作? 012UR [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@「tel:// 12345678」]]]; – 2012-07-30 12:06:58
是調用工作..在第二次提醒之前測試它 – snksnk 2012-07-30 12:18:59