7.打电话的3种方式

2020-11-04  本文已影响0人  bytebytebyte

1.

    NSString *str = @"tel:18337371430";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:nil];

2.
    dispatch_after(0.2, dispatch_get_main_queue(), ^{
        NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"18337371430"];
        UIWebView *callWebview = [[UIWebView alloc] init];
        [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
        [self.view addSubview:callWebview];
    });
3.
    NSMutableString* str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"18611116979"];
    dispatch_after(0.2, dispatch_get_main_queue(), ^{
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:nil];
    });

加入延迟线程就不会打印错误:

[Common] _BSMachError: port 7a03; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
上一篇 下一篇

猜你喜欢

热点阅读