WKWebview加载网页不适配问题

只需给WKWebview添加User-Agent即可解决适配问题,废话不多说,直接桑代码:


NSString *userAgent = [self.webView valueForKey:@"applicationNameForUserAgent"];
NSString *newUserAgent = [NSString stringWithFormat:@"%@%@",userAgent,@"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"];
[self.webView setValue:newUserAgent forKey:@"applicationNameForUserAgent"];

你可能感兴趣的:(WKWebview加载网页不适配问题)