Dial number in iOS really need confirmation?

前端 未结 3 1930
我在风中等你
我在风中等你 2021-01-03 03:39

I am using the following code to dial number and testing with my device. It seems no confirmation is needed, correct?

NSURL *url = [NSURL UR         


        
相关标签:
3条回答
  • 2021-01-03 04:05

    An alternative to the suitable solution already posted, you could consider using the telprompt URL scheme, e.g.

    NSURL *url = [NSURL URLWithString@"telprompt://12345678"];
    [[UIApplication sharedApplication] openURL:url];
    
    0 讨论(0)
  • 2021-01-03 04:12

    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.

    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];
    

    and

    -(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;
        }
    }
    
    0 讨论(0)
  • 2021-01-03 04:21

    Confirmation isn't required but it's desirable as it prevents confusion when users are dropped into the dialing application. one thing that you can do that was suggested by another answer is to use telprompt rather then just tel. This will provide the prompt that's necessary via a simple dialog. It also has a very nice side-effect of dropping users back into the calling application after the phone call is complete. This key elements allows you to keep going rather then getting kicked out of your app.

    A category that further explains this code and a sample project is available here: http://www.raizlabs.com/dev/2014/04/getting-the-best-behavior-from-phone-call-requests-using-tel-in-an-ios-app/

    0 讨论(0)
提交回复
热议问题