本文介绍了不可复制的网络Core崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个iPad应用程序在App Store里已经有三个月了,我已经收到了一些奇怪的崩溃报告,我不知道。这些不是那么频繁,从发射以来有大约15-20个实例,但仍然频繁到足以让我犯错。崩溃有点不同(见下面的堆栈跟踪),但是因为它们与 WebCore 有关我猜想他们与使用 UIWebView ,可能有一个共同的原因,虽然我不是100%积极。应用程式的部署目标是iOS 6.0,但当机会在iPad 2,iPad 3和iPad Mini上显示时,只会在iOS 7上显示。I've got an iPad app that's in the App Store for around three months now and I've been receiving some weird crash reports that I can't figure out. These are not that frequent, got around 15-20 instances since the launch but still frequent enough to actually bug me. The crashes are slightly different (see stack traces below) but since they are related to WebCore I'm guessing they have to do with the usage of the UIWebView in the app and might have a common cause, though I'm not 100% positive. The deployment target of the app is iOS 6.0 but crashes appear on iPad 2, iPad 3 and iPad Mini, exclusively on iOS 7.应用程式只有一个地方我在使用webview,用于显示来自各种来源的新闻文章网页。我有一个视图控制器,它有一个 UIWebView 作为其视图。这个视图控制器有一个实例存在于整个应用程序中,每次选择新文章时,现有的webview将重新加载新选择的文章的url。There is only one place in the app where I'm using a webview, for displaying news article web pages from various sources. I have one view controller for this that has a UIWebView as its view. There is one instance of this view controller that lives throughout the app, each time a new article is selected the existing webview reloads with the url of the newly selected article.根据有关WebCore问题的讨论建议的解决方案之一建议将Web视图委托设置为 nil 在控制器的 dealloc 方法中。不幸的是,我不认为它适用于我的情况,因为视图控制器不会在应用程序的生命周期被释放。 另一个问题可能是CSS中有错误的图像引用的不正确的网页(loadPendingImages崩溃)。我还是找不到这样的页面,虽然。此外,我仔细检查,并确保在主线程进行webview相关的操作。One of the proposed solutions based on the discussion around WebCore issues suggested setting the webviews delegate property to nil in the controller's dealloc method. Unfortunately I don't think it's applicable in my case because the view controller does not get deallocated during the lifecycle of the app.Another issue might be incorrect webpages that have bad image references in the CSS (loadPendingImages crash). I couldn't find such a page yet though.Also, I double-checked and made sure to do webview-related operations on the main thread.崩溃是Exception Type: EXC_BAD_ACCESSCode: KERN_INVALID_ADDRESS与以下堆栈跟踪(完整此处)with the following stack traces (full ones here)0 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 8151 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 7882 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 9483 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 964 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 1425 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 458和0 WebCore WebCore::StyleResolver::loadPendingImages() + 11531 WebCore WebCore::ResourceRequestBase::~ResourceRequestBase() + 1042 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 7823 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 9484 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 965 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142和0 WebCore WebCore::StyleResolver::adjustRenderStyle(WebCore::RenderStyle*, WebCore::RenderStyle*, WebCore::Element*) + 191 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 9642 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 963 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 1424 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 4585 WebCore WebCore::CSSComputedStyleDeclaration::getPropertyValue(WebCore::CSSPropertyID) const + 42和0 WebCore WebCore::TimerBase::heapDeleteMin() + 371 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 942 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 943 WebCore WebCore::timerFired(__CFRunLoopTimer*, void*) + 244 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 145 CoreFoundation __CFRunLoopDoTimer + 782有任何人遇到过类似的崩溃?如果是这样: 1.有复制它们的方法吗? 2.如何在不复制它们的情况下调试这些方法? 3.什么fixes解决了问题?Has anyone experienced similar crashes? If so:1. Are there ways to replicate them?2. How can one debug these without replicating them?3. What fixes solved the issues?谢谢!推荐答案我在我工作的应用程序中有完全相同的问题,它奇怪只发生在运行iOS 7的旧设备上。我怀疑这与他们无法跟上。I had exactly the same issue in an app I worked on, it weirdly only occurred on older devices running iOS 7. I suspect this has something to do with them not being able to keep up.我有一个 UITableView ,其中一行会打开一个 UIViewController UIWebView 上的自定义广告。我发现,在旧的设备对象和内存,其中比我在其他平台上看到的定期更多。我可以很容易地模拟崩溃在iPhone 4通过进/出屏幕2或3次。作为一个iPhone 5我花了15分钟做同样的,不能错过。What I had was a UITableView where one of the rows would open a UIViewController that had a UIWebView on it for custom adverts. What I found is that on the older devices objects and memory where being free'd up far more regularly than I'd seen in other platforms. I could mimic the crash very easily on an iPhone 4 by going in / out of the screen 2 or 3 times. Where as an iPhone 5 I spent 15 minutes doing the same and couldn't fault it.我知道你可能觉得你的控制器没有被释放,但它真的听起来好像是或者一些参考被丢弃,我也看到我的代理引用在这个应用程序也消失了几次。I know you may feel like your controller is not being dealloc'd but it really sounds as though it is or some reference is being dropped, I have also seen my delegate references disappear a few times in this app also.我的建议和什么工作我是停止webview的执行,并设置所有的 nil 当你可以。My advice and what worked for me is to stop the execution of the webview and set everything to nil when you can.在我的应用程序的一个实例中,我选择在 viewWillDisappear 回调中执行它,因为在我的情况下,从用户和以后重新创建,所以我空白的一切如此:In one instance on my app I chose to do it on the viewWillDisappear callback, because in my circumstance it was gone from the user and recreated later, so I blanked everything like so:[webView stopLoading];self.webView.delegate = nil;self.webView = nil; 这篇关于不可复制的网络Core崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-11 04:07