【发布时间】:2013-11-20 11:36:59
【问题描述】:
我的 iPad 应用程序在 App Store 上架了大约三个月,我收到了一些我无法弄清楚的奇怪崩溃报告。这些并不是那么频繁,自发布以来大约有 15-20 个实例,但仍然频繁到足以让我真正烦恼。崩溃略有不同(请参阅下面的堆栈跟踪),但由于它们与 WebCore 有关,我猜它们与应用程序中 UIWebView 的使用有关,并且可能有一个共同原因,尽管我是不是 100% 积极的。该应用程序的部署目标是 iOS 6.0,但崩溃出现在 iPad 2、iPad 3 和 iPad Mini 上,仅在 iOS 7 上。
我在应用程序中只有一个地方使用 webview,用于显示来自各种来源的新闻文章网页。我有一个视图控制器,它有一个UIWebView 作为它的视图。这个视图控制器的一个实例存在于整个应用程序中,每次选择一篇新文章时,现有的 web 视图都会使用新选择的文章的 url 重新加载。
基于围绕 WebCore 问题的讨论提出的解决方案之一建议在控制器的 dealloc 方法中将 webviews delegate 属性设置为 nil。不幸的是,我认为它不适用于我的情况,因为视图控制器在应用程序的生命周期内不会被释放。
另一个问题可能是不正确的网页在 CSS 中有错误的图像引用(loadPendingImages 崩溃)。不过我还没有找到这样的页面。
另外,我仔细检查并确保在主线程上进行了与 webview 相关的操作。
崩溃是
Exception Type: EXC_BAD_ACCESS
Code: KERN_INVALID_ADDRESS
具有以下堆栈跟踪(完整的here)
0 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 815
1 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 788
2 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 948
3 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
4 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142
5 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 458
和
0 WebCore WebCore::StyleResolver::loadPendingImages() + 1153
1 WebCore WebCore::ResourceRequestBase::~ResourceRequestBase() + 104
2 WebCore WebCore::StyleResolver::applyMatchedProperties(WebCore::StyleResolver::MatchResult const&, WebCore::Element const*) + 782
3 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 948
4 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
5 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142
和
0 WebCore WebCore::StyleResolver::adjustRenderStyle(WebCore::RenderStyle*, WebCore::RenderStyle*, WebCore::Element*) + 19
1 WebCore WebCore::StyleResolver::styleForElement(WebCore::Element*, WebCore::RenderStyle*, WebCore::StyleSharingBehavior, WebCore::RuleMatchingBehavior, WebCore::RenderRegion*) + 964
2 WebCore WebCore::Document::styleForElementIgnoringPendingStylesheets(WebCore::Element*) + 96
3 WebCore WebCore::Element::computedStyle(WebCore::PseudoId) + 142
4 WebCore WebCore::ComputedStyleExtractor::propertyValue(WebCore::CSSPropertyID, WebCore::EUpdateLayout) const + 458
5 WebCore WebCore::CSSComputedStyleDeclaration::getPropertyValue(WebCore::CSSPropertyID) const + 42
和
0 WebCore WebCore::TimerBase::heapDeleteMin() + 37
1 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 94
2 WebCore WebCore::ThreadTimers::sharedTimerFiredInternal() + 94
3 WebCore WebCore::timerFired(__CFRunLoopTimer*, void*) + 24
4 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
5 CoreFoundation __CFRunLoopDoTimer + 782
有没有人遇到过类似的崩溃?如果是这样:
1. 有没有办法复制它们?
2. 如何在不复制它们的情况下调试它们?
3. 哪些修复解决了这些问题?
谢谢!
【问题讨论】:
-
iOS 7 在图形渲染方面存在几个主要问题。您试图追查的问题很可能是操作系统级别(或 SDK 级别)的问题。冒昧地猜测一下,有一些 CSS 转换或动画会导致崩溃。找出原因的唯一希望是找到导致它的页面,即使这样,您也可能无能为力。
-
是的,不幸的是我还没有自己复制它,因为我正在从各种 (30+) 新闻来源加载新闻文章,所以我觉得我做不到很快。如果没有其他人对这里可能发生的事情有更好的了解,我们将不得不等待 iOS 7.1,看看他们是否解决了这些问题。
-
我已经在cordova ios7中复制了这个错误,在递归循环中使用window.requestAnimationFrame来对精灵表情进行步进动画。似乎当应用从长时间的睡眠中醒来并尝试再次动画时会发生这种情况。
-
不幸的是,7.1 并没有解决这些问题。至少在 beta2 中没有。
标签: ios objective-c ipad uiwebview crash