我遇到了某种崩溃,这是崩溃堆栈:
WebCore 0x353c81b4 WebCore::PageCache::markPagesForFullStyleRecalc(WebCore::Page*) + 20
WebKit 0x36a6a45f -[WebView(WebPrivate) _initWithFrame:frameName:groupName:usesDocumentViews:] + 139
WebKit 0x36a6a3cd -[WebView initWithFrame:frameName:groupName:] + 53
WebKit 0x36a6a393 -[WebView initWithFrame:] + 47
UIKit 0x37251bfb -[UIWebDocumentView initWithWebView:frame:] + 287
UIKit 0x372828d1 -[UIWebBrowserView initWithWebView:frame:] + 57
UIKit 0x37282891 -[UIWebDocumentView initWithFrame:] + 41
UIKit 0x37282809 -[UIWebBrowserView initWithFrame:] + 49
UIKit 0x37437d73 -[UIWebView _webViewCommonInitWithWebView:scalesPageToFit:shouldEnableReachability:] + 235
UIKit 0x374385a9 -[UIWebView initWithFrame:] + 81
SeMob 0x001c216d -[SeMobWebInternalView initWithFrame:] (SeMobWebInternalView.m:64)
SeMob 0x001e7761 -[SeMobWebReader prepareReaderInWebView:] (SeMobWebReader.m:102)
SeMob 0x000eeb0d -[SeMobWebView webViewDidFinishLoad:] (SeMobWebView.m:1475)
CoreFoundation 0x346979c4 __invoking___ + 68
CoreFoundation 0x345eefeb -[NSInvocation invoke] + 287
CoreFoundation 0x345eeb43 -[NSInvocation invokeWithTarget:] + 51
WebKit 0x36a6189b -[_WebSafeForwarder forwardInvocation:] + 375
CoreFoundation 0x3469661b ___forwarding___ + 627
CoreFoundation 0x345edf68 __forwarding_prep_0___ + 24
CoreFoundation 0x346979c4 __invoking___ + 68
CoreFoundation 0x345eefeb -[NSInvocation invoke] + 287
WebCore 0x354197eb _ZL11SendMessageP12NSInvocation + 27
WebCore 0x35456fa5 _ZL20HandleDelegateSourcePv + 81
CoreFoundation 0x34669683 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
CoreFoundation 0x34668ee9 __CFRunLoopDoSources0 + 213
CoreFoundation 0x34667cb7 __CFRunLoopRun + 647
CoreFoundation 0x345daebd CFRunLoopRunSpecific + 357
CoreFoundation 0x345dad49 CFRunLoopRunInMode + 105
GraphicsServices 0x353432eb GSEventRunModal + 75
UIKit 0x37220301 UIApplicationMain + 1121
SeMob 0x000d48a7 main (main.m:12)
和两段代码:
- (void)prepareReaderInWebView:(UIWebView *)webView
{
// ...omit some code here
if ([readableContent length]) {
self.innerWebView = [[[SeMobWebInternalView alloc] initWithFrame:webView.bounds] autorelease];
innerWebView.scalesPageToFit = NO;
innerWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
innerWebView.scrollView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
innerWebView.scrollView.scrollsToTop = YES;
innerWebView.delegate = self;
...
}
@interface SeMobWebInternalView : UIWebView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
UIMenuItem *flag =
[[UIMenuItem alloc] initWithTitle:@"search" action:@selector(search:)];
...
}
崩溃始终是超级init方法中的occers。它为什么总是崩溃? Plz帮助我!
答案 0 :(得分:0)
Apple文档说UIWebView不应该是子类:
检查子类记录。
答案 1 :(得分:0)
正如@cosmin所说,你不打算将UIWebView子类化,从你的代码看起来你试图自定义外观。请尝试使用此代码:
webView.backgroundColor = [UIColor clearColor]; // changes to clear colour
webView.opaque = NO;
for(UIView *innerView in [[[webView subviews] objectAtIndex:0] subviews]) { // Hide images that make shadow
if ([innerView isKindOfClass:[UIImageView class]]) {
innerView.hidden = YES;
}
}