iOS应用程序内打开指定qq聊天、给某人打电话

时间:2023-12-21 19:48:02
-(void)btn2Clik
{
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSURL *url = [NSURL URLWithString:@"mqq://im/chat?chat_type=wpa&uin=填写qq号码&version=1&src_type=web"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
webView.delegate = self;
[webView loadRequest:request];
[self.view addSubview:webView];
}

打电话

  方法一

   //用UIWebView来实现,打电话结束后会返回当前应用程序:

     UIWebView *callPhoneWebVw = [[UIWebView alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"tel://1008611"]];
[callPhoneWebVw loadRequest:request];

    [self.view addSubview:callPhoneWebVw];

 

  方法二

//1、系统的打电话代码,不返回当前程序:

     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://1008611"]];