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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM