在iOS中拨打号码真的需要确认? [英] Dial number in iOS really need confirmation?

查看:145
本文介绍了在iOS中拨打号码真的需要确认?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码拨打号码并使用我的设备进行测试。

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中拨打号码真的需要确认?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆