Code control calls, text messages, email, open mobile app and other operations

Source: Internet
Author: User

  Many times we need to use our own app to make some phone calls, text messages and other operations, then how to use the code to implement it, here are some simple ways to implement these operations.

Call:

<1> the simplest and most straightforward way to jump directly to the dial-up interface

Nsurl *url = [Nsurl urlwithstring:@ "tel://10010"];

[[UIApplication sharedapplication] openurl:url];

Disadvantage: After the call, you can not jump back to the original application, but directly stay in the call record interface.

 <2> before dialing the box to ask the user whether to dial, after the dial can automatically return to the original application.

    Nsurl *url = [Nsurl urlwithstring:@ "telprompt://10010"];

    [[UIApplication sharedapplication] openurl:url];

    disadvantage: Because it is a private API, it may not be approved. <3> Create a uiwebview to load the URL and automatically go back to the original app when you're finished dialing

if (_webview = = nil) {

_webview = [[UIWebView alloc] Initwithframe:cgrectzero];

}

[_webview loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:@ "tel://10010"]];

    Note: This webview must not be added to the interface, or it will block other interfaces

Code control calls, text messages, email, open mobile app and other operations

Related Article

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.