2019-07-17
参考这两篇文章就够了:
https://juejin.im/post/5abca877f265da238155b6bc#heading-7
https://blog.csdn.net/tencent_bugly/article/details/54668721/
2019-10-28
升级完Xcode11和iOS13之后 发现iPad13上的H5跟原声交互调不起来了,同事帮我解决了
重新设置了iOS WebView UserAgent;
什么是User Agent?简单了解一下:https://www.jianshu.com/p/023f7cd1927c
代码如下:
[_webView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id result, NSError *error) {
if (error) { return; }
NSString *userAgent = result;
//XXXXXXXXX为跟H5约定好的字符串
if (![userAgent containsString:@"XXXXXXXXX"]) {
userAgent = [userAgent stringByAppendingString:@"XXXXXXXXX"];
if(@available(iOS 12.0, *)){
_webView.customUserAgent = userAgent;
}else{
NSDictionary *dict = @{@"UserAgent": userAgent};
[TKUserDefaults registerDefaults:dict];
}
}
}];
又发现在iPad13上present出来的页面(vc)不是全屏了,
设置下 vc.modalPresentationStyle = 0; 就好了
网友评论