Implement call callback app inside

Source: Internet
Author: User

Now there may be a customer service application in this category of things, here we do not want to do that kind of instant online chat function, shorten the project cycle. So we're going to just drop the system phone to do this, but we use the system's api-->[[uiapplication sharedapplication] Openurl:[nsurl urlwithstring:@ "Tel ://phonenum "]; But the problem is that when we finish the call, he jumps back to the phone interface of the system, does not conform to the logic of the general application, we have to do the call after the end of the callback to the original interface in our app. Here are two ways to give it to everyone and show the code as follows:

1. Method One: Use the private API to implement callbacks.

[[UIApplication sharedapplication] openurl:[nsurl urlwithstring:@ "telprompt://10086"];

Here use 10086来 test, harassment phone, hehe.

2. Method Two: Use the Web call, this is legal can be approved by the app.

code example:

//UIWebView *phonecallwebview;
-(void) Dialphonenumber: (NSString *) Aphonenumber
{  
Nsurl *phoneurl = [Nsurl urlwithstring:[nsstring stringwithformat:@ "tel:%@", Aphonenumber]];
if (!phonecallwebview) {
Phonecallwebview = [[UIWebView alloc] Initwithframe:cgrectzero];
    }  
[Phonecallwebview loadrequest:[nsurlrequest Requestwithurl:phoneurl];
}  
-(void) Dealloc
{  
//Cleanup
[Phonecallwebview release], Phonecallwebview = nil;
[Super Dealloc];
}  

Implement call callback app inside

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.