【发布时间】:2015-07-09 06:36:52
【问题描述】:
在我的可可应用程序中,我使用 WebView 来加载我的 URL。根据我的要求,我将每 10 分钟重新加载一次 URL。但有时,当我尝试重新加载时,应用程序崩溃了。我正在使用下面的代码在 webview 中加载 URL。
样本.h
#import <WebKit/WebKit.h>
@property(nonatomic,retain) IBOutlet WebView *webview;
示例.m
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.dummyurl.com"]];
[self->webview.mainFrame loadRequest:request];
堆栈跟踪:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff56efeff8
VM Regions Near 0x7fff56efeff8:
MALLOC_TINY 00007f9e7b000000-00007f9e7b100000 [ 1024K] rw-/rwx SM=ZER
--> STACK GUARD 00007fff536ff000-00007fff56eff000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0
Stack 00007fff56eff000-00007fff576ff000 [ 8192K] rw-/rwx SM=COW thread 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.WebCore 0x00007fff90238264 WebCore::RenderObject::containingBlock() const + 4
1 com.apple.WebCore 0x00007fff9036cdaf WebCore::RenderBlock::computeBlockPreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 63
2 com.apple.WebCore 0x00007fff90d0524a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 58
3 com.apple.WebCore 0x00007fff9047eaab WebCore::RenderBox::computeIntrinsicLogicalWidthUsing(WebCore::Length, WebCore::LayoutUnit, WebCore::LayoutUnit) const + 187
4 com.apple.WebCore 0x00007fff9033f8f4 WebCore::RenderBox::computeReplacedLogicalWidthUsing(WebCore::Length) const + 212
5 com.apple.WebCore 0x00007fff9033f707 WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(WebCore::LayoutUnit, WebCore::ShouldComputePreferred) const + 215
6 com.apple.WebCore 0x00007fff9033f572 WebCore::RenderReplaced::computeReplacedLogicalWidth(WebCore::ShouldComputePreferred) const + 1074
7 com.apple.WebCore 0x00007fff9033fcfb WebCore::RenderReplaced::computePreferredLogicalWidths() + 139
8 com.apple.WebCore 0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
9 com.apple.WebCore 0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
10 com.apple.WebCore 0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
11 com.apple.WebCore 0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
12 com.apple.WebCore 0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
13 com.apple.WebCore 0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
14 com.apple.WebCore 0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
15 com.apple.WebCore 0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
16 com.apple.WebCore 0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
17 com.apple.WebCore 0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
18 com.apple.WebCore 0x00007fff90d0523a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 42
19 com.apple.WebCore 0x00007fff9031f6a4 WebCore::RenderBlock::computePreferredLogicalWidths() + 356
20 com.apple.WebCore 0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
21 com.apple.WebCore 0x00007fff9036d07c WebCore::RenderBlock::computeBlockPreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 780
22 com.apple.WebCore 0x00007fff90d0524a WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) const + 58
23 com.apple.WebCore 0x00007fff9047eaab WebCore::RenderBox::computeIntrinsicLogicalWidthUsing(WebCore::Length, WebCore::LayoutUnit, WebCore::LayoutUnit) const + 187
24 com.apple.WebCore 0x00007fff9033f8f4 WebCore::RenderBox::computeReplacedLogicalWidthUsing(WebCore::Length) const + 212
25 com.apple.WebCore 0x00007fff9033f707 WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(WebCore::LayoutUnit, WebCore::ShouldComputePreferred) const + 215
26 com.apple.WebCore 0x00007fff9033f572 WebCore::RenderReplaced::computeReplacedLogicalWidth(WebCore::ShouldComputePreferred) const + 1074
27 com.apple.WebCore 0x00007fff9033fcfb WebCore::RenderReplaced::computePreferredLogicalWidths() + 139
28 com.apple.WebCore 0x00007fff902c4d0b WebCore::RenderBox::minPreferredLogicalWidth() const + 27
29 com.apple.WebCore 0x00007fff90320611 WebCore::RenderBlock::computeInlinePreferredLogicalWidths(WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 3105
有人请提供解决此问题的解决方案吗?
PS:我在我的项目中使用 ARC。
【问题讨论】:
标签: objective-c cocoa webview