App調(diào)用系統(tǒng)方式有兩種,
第一:點(diǎn)擊,會(huì)彈出窗口,選擇是否撥打;撥打后回自動(dòng)跳轉(zhuǎn)到原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系統(tǒng)使用此openURL方法
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:nil];
}else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
}
@end
第二種:點(diǎn)擊直接就撥打號(hào)碼,撥打結(jié)束后無(wú)法跳會(huì)原APP界面
NSString *allString = [NSString stringWithFormat:@"tel:10086"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:allString]];
建議:選擇第一種,比較人性化.