问题描述
我正在使用以下代码拨打号码并使用我的设备进行测试.似乎不需要确认,对吗?
I am using the following code to dial number and testing with my device. It seems no confirmation is needed, correct?
NSURL *url = [NSURL URLWithString:@"tel://12345678"];
[[UIApplication sharedApplication] openURL:url];
推荐答案
确认不是必需的,并且在以编程方式完成时不会显示.如果单击数字,您只会在 Safari 中看到 alertView.
Confirmation isn't required and isn't shown when done programmatically. You will only see the alertView in Safari if a number is clicked.
但是,根据我自己的经验,我相信客户看到对话框会更方便,这样他们就不会不小心给某人打电话.人们只是想都没想就点击应用中的东西,在这种情况下可能会很糟糕.
However, in my own experience, I believe it's more convenient for the customer to see a dialog box so they don't accidentally call someone. People just tap things in apps without even thinking and that could be bad in this case.
要模仿 safari 的功能,您可以执行以下操作:
To mimic what safari does you can do something like this:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Call 12345678?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Call", nil];
[alert show];
alert.tag = 1;
[alert release];
和
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (alertView.tag) {
case 1:
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"tel://12345678"];
[[UIApplication sharedApplication] openURL:url];
}
break;
default:
break;
}
}
这篇关于iOS中的拨号真的需要确认吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!