Thread : Crashed: com.apple.main-thread0 libobjc.A.dylib 0x34217f46 objc_msgSend + 51 UIKit 0x29a2d5a3 -[UIWebVIEw webVIEw:decIDePolicyForNavigationAction:request:frame:decisionListener:] + 1822 CoreFoundation 0x2630cad4 __invoking___ + 683 CoreFoundation 0x26239645 -[NSInvocation invoke] + 3004 CoreFoundation 0x2623d0c7 -[NSInvocation invokeWithTarget:] + 505 WebKitLegacy 0x326d9261 -[_WebSafeForwarder forwardInvocation:] + 2246 CoreFoundation 0x2630b62f ___forwarding___ + 3547 CoreFoundation 0x2623d008 _CF_forwarding_prep_0 + 248 CoreFoundation 0x2630cad4 __invoking___ + 689 CoreFoundation 0x26239645 -[NSInvocation invoke] + 30010 WebCore 0x31c02729 HandleDelegateSource(voID*) + 10011 CoreFoundation 0x262cefbf __CFRUNLOOP_IS_CALliNG_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 1412 CoreFoundation 0x262ce461 __CFRunLoopDoSources0 + 36413 CoreFoundation 0x262cca35 __CFRunLoopRun + 77214 CoreFoundation 0x2621a3b1 CFRunLoopRunspecific + 47615 CoreFoundation 0x2621a1c3 CFRunLoopRunInMode + 10616 GraphiCSServices 0x2d801201 GSEventRunModal + 13617 UIKit 0x2988443d UIApplicationMain + 144018 abc 0x0030dcd7 main (main.m:14)
我可以理解它在webvIEw委托上发生了一些回调并且发生了不好的过量,所以为了纠正这个问题,我通过
[self.webvIEw stopLoading];self.webvIEw.delegate =nil;
在所有课程中,我可以看到这个崩溃.你能告诉我可能出现的问题以及纠正这种情况的方法吗?
解决方法 以下可能就是这种情况>用户将看到一个带有UIWebVIEw的屏幕
> UIVIEwController在委托网页开始下载时设置self
>用户退出屏幕
> UIVIEwController获取解除分配UIWebVIEw完成加载并发送我已完成加载消息到其委托
要么
当webvIEw对象不再是.i.e悬挂指针效果时,会调用其他一些委托方法
1.始终确保在离开视图之前停止加载webVIEw并删除委托
Before releasing an instance of UIWebVIEw for which you have set a
delegate,you must first set its delegate property to nil. This can
be done,in yourdealloc
method
这是reference
// If ARC is used- (voID)dealloc { [_webVIEw setDelegate:nil]; [_webVIEw stopLoading];}// If ARC is not used- (voID)dealloc { [webVIEw setDelegate:nil]; [webVIEw stopLoading]; [webVIEw release]; [super dealloc];}// ARC - Before iOS6 as its deprecated from it.- (voID)vIEwWillUnload { [webVIEw setDelegate:nil]; [webVIEw stopLoading];}
2.确保你在vIEwWilldisappear中没有stopLoading和setDelegate为nil
if the VIEwController is a child of a another VIEwController,u can
trigger the removal of the VIEwController’s vIEw from the parent
VIEwController’s vIEw with an animation. At the same time,u can
remove the VIEwController from its parent andnil
out its reference.
at this pointVIEwController
will benil
andvIEwWilldisappear
will never be called,meaning the WebVIEw delegate will never be
cleaned upUse
dealloc
and ensure that your WebVIEw is always cleaned up.
3.确保在没有动画的情况下将webvIEw子视图的ContentOffset设置为CGPointZero
In iPad in some versions while webvIEw is scrolling if you close the parent
vIEwcontroller without setting ContentOffset toCGPointZero
this
kind of problems will come
所以最好在关闭它之前调用父视图控制器中的以下代码
for (ID subvIEw in webVIEw.subvIEws){ if ([[subvIEw class] isSubclassOfClass: [UIScrollVIEw class]]){ [subvIEw setContentOffset:CGPointZero animated:NO]; } }
希望这会有所帮助.随意问你的疑惑.
4.一般来说,您不应该在UIScrollVIEw对象中嵌入UIWebVIEw对象.如果这样做,可能会导致意外行为,因为两个对象的触摸事件可能混淆和错误处理.
这是reference
总结以上是内存溢出为你收集整理的ios:Webview委托的EXC_BAD_ACCESS全部内容,希望文章能够帮你解决ios:Webview委托的EXC_BAD_ACCESS所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)