今天用到系统的拨打电话,偶然发现,其实是有多种选择的;下面说一下常用的两种,和展示情况
1.推荐使用,这种方法,系统会自动弹出提示框(模拟器不会弹框,真机才可以)
NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@", phoneNum];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
2.之前常用,这种方法,拨打完电话回不到原来的应用(iOS8之前),会停留在通讯录里,而且是直接拨打,不弹出提示框
NSString *callPhone = [NSString stringWithFormat:@"tel:%@", @"131xxxx7751"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
1和2,注意要区别 telprompt:// 和 tel: 一定要看清楚了;