iOS 从app跳转到Safari、从app打开电话呼叫

1.从app跳转到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.从app打开电话呼叫

 1  NSString *phoneNum = @"10086";// 电话号码
 2         
 3         UIWebView *phoneCallWebView;
 4         NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",phoneNum]];
 5          if ( !phoneCallWebView ) {
 6         phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];// 这个webView只是一个后台的View 不需要add到页面上来
 7             
 8              }
 9         [phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];
10         
11         [self.view addSubview:phoneCallWebView];

转载于:https://www.cnblogs.com/pretty-guy/p/4181760.html

猜你喜欢

转载自blog.csdn.net/weixin_33801856/article/details/93199902