App调用系统方式有两种,
第一:点击,会弹出窗口,选择是否拨打;拨打后回自动跳转到原App界面.
#define iOS10Later ([UIDevice currentDevice].systemVersion.floatValue >= 10.0f)
#import "PhoneTool.h"
@implementation PhoneTool
+ (void)callPhoneByNumber:(NSString *)num{
NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"tel:%@",num];
if (iOS10Later) {
/// 大于等于10.0系统使用此openURL方法
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:nil];
}else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
}
@end
第二种:点击直接就拨打号码,拨打结束后无法跳会原APP界面
NSString *allString = [NSString stringWithFormat:@"tel:10086"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:allString]];
建议:选择第一种,比较人性化.