NSString *callPhone = [NSString stringWithFormat:@"telprompt://%@",@"183 0522 3025"];
NSURL *url = [NSURL URLWithString:callPhone];
打不出去你敢信么开镣?哗咆??蒿柳?哈哈哈哈饶套。。垒探。
真的是特別詭異特別詭異詭異凹寺!;稹8蚩恕!R奈谩9辜贰!惕鼓!
機(jī)智如我呢~~~把里面的東西都去掉筋现,然后只留下數(shù)字總行了吧。箱歧。
- (void)btnc {
NSString *str = [self xxfilterCharactor:@"[^0-9]" str:@"183 0522 3025"];
NSString *callPhone = [NSString stringWithFormat:@"tel:%@",str];
NSURL *url = [NSURL URLWithString:callPhone];
[[UIApplication sharedApplication] openURL:url options:[NSDictionary dictionary] completionHandler:^(BOOL success) {
}];
}
- (NSString *)xxfilterCharactor:(NSString *)filter str:(NSString *)str{
NSString *filterText = str;
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:filter options:NSRegularExpressionCaseInsensitive error:&error];
NSString *result = [regex stringByReplacingMatchesInString:filterText options:NSMatchingReportCompletion range:NSMakeRange(0, str.length) withTemplate:@""];
return result;
}
雖然機(jī)智的解決了問題矾飞,但是我不知道為什么。呀邢。