When we call this function, we often call this method:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://xxxxx"]];
However, after the function is implemented, you cannot return to your application after the call is completed. I recently searched a lot on the Internet, and Apple did not provide callback functions. Powerful netizens use the uiwebview control to implement this method.
The Code is as follows:
- (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]; }
There is also a method that cannot be uploaded to the appstore.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://xxxx"]];
That is, change Tel to telprompt.
You can try it.