[英]App got crashed when i reload the url in cocoa webview
In my cocoa application, I am using WebView to load my URL. 在我的可可应用程序中,我正在使用WebView加载我的URL。 For my requirement, I will reload the URL for every 10 minutes. 根据我的要求,我将每10分钟重新加载一次URL。 But sometimes, the app got crashed when I am trying to reload. 但是有时,当我尝试重新加载时,应用程序崩溃了。 I am using the below code to load the URL in webview. 我正在使用以下代码在Webview中加载URL。
sample.h 样本
#import <WebKit/WebKit.h>
@property(nonatomic,retain) IBOutlet WebView *webview;
Sample.m 样例
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"www.dummyurl.com"]];
[self->webview.mainFrame loadRequest:request];
StackTrace: 堆栈跟踪:
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
Anyone please provide the solution to resolve this issue? 任何人都可以提供解决此问题的解决方案?
PS : I am using ARC in my project. PS:我在项目中使用ARC。
i suggest you set exception breakpoint to find exact problem with your code , but i hope your problem is Released object i think your UIWebView or Url become to nil. 我建议您设置异常断点以查找代码的确切问题,但是我希望您的问题是Released对象,我认为您的UIWebView或Url变为nil。 please use strong property for your objects. 请为您的对象使用坚固的属性。 can you show a little of your code ? 您可以显示一些代码吗? do you use custom webview or custom webkit ? 您使用自定义Webview还是自定义Webkit?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.