iOS jump from app to Safari, open a telephone call from the app

1. Go to app from Safari

1 NSString* strIdentifier = @"http://www.ybyb.com";
2             BOOL isExsit = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:strIdentifier]];
3             if(isExsit) {
4                 NSLog(@"App %@ installed", strIdentifier);
5                 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:strIdentifier]];
6             }

 

2. Open the phone call from the app

. 1   NSString phoneNum * = @ " 10086 " ; // phone number 
2          
. 3          the UIWebView * phoneCallWebView;
 . 4          NSURL phoneURL * = [NSURL URLWithString: [NSString stringWithFormat: @ " Tel:% @ " , phoneNum]];
 . 5           IF (! PhoneCallWebView ) {
 . 6          phoneCallWebView = [[the UIWebView the alloc] the initWithFrame: CGRectZero]; // this is just a background View webView need not add up to the page 
. 7              
. 8               }
 . 9          [phoneCallWebView loadRequest: [NSURLRequest requestWithURL: phoneURL]];
 10          
. 11         [self.view addSubview:phoneCallWebView];

 

Reproduced in: https: //www.cnblogs.com/pretty-guy/p/4181760.html

Guess you like

Origin blog.csdn.net/weixin_33801856/article/details/93199902