Malloc: * error for object 0x1740b6e00: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug
WKWebView 出现这个错误的原因是由于调试的真机iPhone的Safari开启了连接Mac的js调试功能。设置——>Safari——>高级——>JavaScript,关闭。
作者:彭OO
链接://www.greatytc.com/p/3ab6a2990868
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
self.webView.scrollView.bounces = false 禁止边界弹动 在iOS11以下系统会造成 webview的弹窗点击失效
一个困扰已久的UIScrollView问题
https://blog.csdn.net/dlmlzz09/article/details/71730423
contentSize>scrollview的size 的情况下 除了 self.webView.scrollView.bounces = false的话 还能怎样禁止弹簧效果?
https://stackoverflow.com/questions/36407633/how-to-stop-uiwebview-from-bouncing-vertically-scrolling-bottom/36482545
//fix 拉到最底部 再往上滑动
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if (scrollView.contentOffset.y >= scrollView.contentSize.height - scrollView.frame.size.height) {
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, scrollView.contentSize.height - scrollView.frame.size.height - 2), animated: false)
}else if (scrollView.contentOffset.y <= 0) {
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, 0), animated: false)
}
}
但是在iOS11 + 上 会崩溃到setContentOffset上
error : Trying to put the stack in unreadable memory setContentOffset
处理方法如下
https://stackoverflow.com/questions/19185748/unable-to-setcontentoffset-in-scrollviewdidenddragging
if scrollView == self.webView.scrollView {
if (self.webView.scrollView.contentOffset.y >= self.webView.scrollView.contentSize.height - self.webView.scrollView.frame.size.height) {
self.webView.scrollView.delegate = nil
self.webView.scrollView.setContentOffset(CGPointMake(self.webView.scrollView.contentOffset.x, self.webView.scrollView.contentSize.height - self.webView.scrollView.frame.size.height - 2), animated: false)
self.webView.scrollView.delegate = self
}else if (self.webView.scrollView.contentOffset.y <= 0) {
self.webView.scrollView.delegate = nil
self.webView.scrollView.setContentOffset(CGPointMake(self.webView.scrollView.contentOffset.x, 0), animated: false)
self.webView.scrollView.delegate = self
}
}
配置webview和禁止弹簧scrollview
if #available(iOS 11.0, *) {
self.webView.scrollView.delegate = nil
webView.scrollView.contentInsetAdjustmentBehavior = .never
} else {
self.webView.scrollView.delegate = self
automaticallyAdjustsScrollViewInsets = false
}
self.webView.navigationDelegate = self
self.webView.scrollView.bouncesZoom = false
self.webView.scrollView.bounces = false