IOS development-call Summary

Source: Internet
Author: User

I know three methods for calling iOS apps:


I. Use openURL (tel)

Features: direct dialing. No prompt is displayed. In addition, after the dial is complete, it is left in the address book and will not return to the original application.

// Call-(void) callPhone :( NSString *) phoneNumber {// phoneNumber = "18369 ...... "NSMutableString * str = [[NSMutableString alloc] initWithFormat: @" tel: % @ ", phoneNumber]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: str];}

II. Use requestWithURL (recommended)

Features: a prompt is displayed before the call. In addition, after dialing, the system will return to the original application.

// Call-(void) callPhone :( NSString *) phoneNumber {// phoneNumber = "18369 ...... "NSMutableString * str = [[NSMutableString alloc] initWithFormat: @" tel: % @ ", phoneNumber]; UIWebView * callWebview = [[UIWebView alloc] init]; [callWebview loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: str]; [self. view addSubview: callWebview];}

3. Use openURL (telprompt)

Features: a prompt is displayed before the call. In addition, after dialing, the system will return to the original application.

Note: telprompt has not been found in Apple's official documentation, and has been used before. This was rejected during the upload review.

// Call-(void) callPhone :( NSString *) phoneNumber {// phoneNumber = "18369 ...... "NSMutableString * str = [[NSMutableString alloc] initWithFormat: @" telprompt: // % @ ", phoneNumber]; [[UIApplication sharedApplication] openURL: [NSURL URLWithString: str];}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.