ios app跳转拨打电话界面,调用拨打电话功能

 

 

  DNLogFUNC

//两种方法都可以用

//这种据说是可以上appstore

    NSURL *phoneURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",PhoneNumber]];

    if ( !_phoneCallWebView ) {

        _phoneCallWebView = [[UIWebView alloc] initWithFrame:CGRectZero];

    }

    [_phoneCallWebView loadRequest:[NSURLRequest requestWithURL:phoneURL]];

    

    

//    // 处理电话号码

//    NSString* sOriginPhoneNum = PhoneNumber;

//    // 处理中文分隔符-,导致无法拨打电话

//    NSMutableCharacterSet *charSet = [[NSMutableCharacterSet alloc] init] ;

//    [charSet formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]];

//    [charSet formUnionWithCharacterSet:[NSCharacterSet punctuationCharacterSet]];

//    [charSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];

//    NSArray *arrayWithNumbers = [sOriginPhoneNum componentsSeparatedByCharactersInSet:charSet];

//    NSString *numberStr = [arrayWithNumbers componentsJoinedByString:@""];

//    if (!numberStr) {

//        numberStr = @"";

//    }

//    

//    // 拨打电话号码,据说上商店会被拒,欢迎分享意见. telprompt:有弹窗,tel:没弹窗。

//    NSString *url = [NSString stringWithFormat:@"telprompt:%@", numberStr];

//    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

posted @ 2016-07-14 11:40  SoulDu  阅读(1913)  评论(0编辑  收藏  举报