ios实现拨打电话以及跳转App Store

2016-08-12  本文已影响2344人  Louis_hey

参考原文:http://blog.csdn.net/ouy_huan/article/details/30506925
//前面两种会弹框提示拨打,第三种是直接拨打(之前是挂了电话不会回到当前app),经测试现在三种方式挂了电话都会回到app当前页面

//方式一,有弹框提示
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"131****"];
    UIWebView * callWebview = [[UIWebView alloc] init];
    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
    [self.view addSubview:callWebview];
//方式二,有弹框提示
//注意这里的是telprompt,其他和第三种完全一样
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"131****"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
//方式三,无弹框提示
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"131****"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

跳转到App Store

//跳转到App Store 
NSString *url = @"https://itunes.apple.com/cn/app/***";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

//获取app在App Store 上面的地址,在电脑上面进入itunes,点击头像,单击右键,拷贝地址,如获取QQ的地址:


上一篇 下一篇

猜你喜欢

热点阅读