ios 拨打电话

来源:互联网 发布:淘宝中学科学实验室 编辑:程序博客网 时间:2024/05/17 23:40
打电话有两种方式:
方式一:
[[UIApplication  sharedApplication] openURL:[NSURL  URLWithString:@"tel://10086"]];
方式二:
[[UIApplication  sharedApplication] openURL:[NSURL  URLWithString:@"telprompt://10086"]];

方式一:执行后直接进入打电话界面
方式二:执行后,弹出是否拨打号码的alert,选择“是”后,进入打电话界面




方式三:

- (IBAction)callAction:(UIButton *)sender {

    [self dialPhoneNumber:@"10086"];

}

- (void) dialPhoneNumber:(NSString *)aPhoneNumber

{

    NSURL *phoneURL = [NSURLURLWithString:[NSStringstringWithFormat:@"tel:%@",aPhoneNumber]];

    if ( !_phoneCallWebView ) {

        _phoneCallWebView = [[UIWebViewalloc]initWithFrame:CGRectZero];

    }

    [_phoneCallWebViewloadRequest:[NSURLRequestrequestWithURL:phoneURL]];

}



建议采用方式三利于通过审核,方式一和方式二也许不能通过审核


0 0
原创粉丝点击