天天看點

iOS10使用web方式沒法跳到QQ聊天界面

之前用下面的代碼來做一個聯系客服的QQ跳轉方式

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString *qq=[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",SM910QQSERVICE];
NSURL *url = [NSURL URLWithString:qq];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
    //    webView.delegate = self;
[webView loadRequest:request];
[self addSubview:webView];
           

但是更新了iOS10以後,測試同僚說沒法跳轉到QQ了,然後改了一下,就可以跳轉了

NSString *qq=[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",SM910QQSERVICE];
NSURL *url = [NSURL URLWithString:qq];
[[UIApplication sharedApplication] openURL:url];