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];}