首页 > 代码库 > iOS 从app跳转到Safari、从app打开电话呼叫

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

 

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