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