iphone - SendDelegateMessage 等待10秒后返回失败

标签 iphone objective-c ios uiwebview

我刚刚在我们的应用程序中添加了一个非常简单的基于 UIWebView 的嵌入式浏览器。这可以很好地加载和导航页面,但是一旦我旋转设备,整个 UI 就会停止响应。但是,它仍在运行,我可以暂停应用程序,并打印回溯:

(gdb) bt
#0  0x00f35bd4 in -[CALayer addAnimation:forKey:] ()
#1  0x00f283e3 in endChange ()
#2  0x00f2a535 in CALayerSetBounds ()
#3  0x00f2a2b6 in -[CALayer setBounds:] ()
#4  0x00573307 in -[UIView(Geometry) setFrame:] ()
#5  0x006c1a3a in -[UIWebDocumentView setFrame:] ()
#6  0x008aad59 in -[UIWebBrowserView setFrame:] ()
#7  0x006c1277 in -[UIWebDocumentView _updateSize] ()
#8  0x002a76c1 in _nsnote_callback ()
#9  0x019d4f99 in __CFXNotificationPost_old ()
#10 0x0195433a in _CFXNotificationPostNotification ()
#11 0x0029d266 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#12 0x0196d67d in __invoking___ ()
#13 0x0196d551 in -[NSInvocation invoke] ()
#14 0x027db82a in SendDelegateMessage ()
#15 0x027ba138 in WKViewSetBoundsSize ()
#16 0x02825628 in WebCore::ScrollView::platformSetContentsSize ()
#17 0x0282552b in WebCore::ScrollView::setContentsSize ()
#18 0x027d8ccc in WebCore::FrameView::setContentsSize ()
#19 0x027e8b27 in WebCore::FrameView::adjustViewSize ()
#20 0x027c68a4 in WebCore::FrameView::layout ()
#21 0x027dd1e0 in WebCore::Document::updateLayout ()
#22 0x027dd0fe in WebCore::Document::updateLayoutIgnorePendingStylesheets ()
#23 0x0285bc7b in WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue ()
#24 0x0285a768 in WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue ()
#25 0x02910963 in WebCore::CSSStyleDeclaration::getPropertyCSSValue ()
#26 0x0291017b in WebCore::JSCSSStyleDeclaration::nameGetter ()
#27 0x02053d1f in JSC::JSValue::get ()

有时,但不总是,我也会在控制台中得到这个:

void SendDelegateMessage(NSInvocation*): delegate (<CFNotificationCenter 0x5e199c0 [0x1a6a3e0]>) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

这是 WebViewController 的实现:

- (void)viewDidLoad {
    [super viewDidLoad];

    backButton.enabled = NO;
    forwardButton.enabled = NO;

    pageTitle.title = [self.url absoluteString];
    [webView loadRequest:[NSURLRequest requestWithURL:self.url]];
}

#pragma mark -
#pragma mark UI Actions

-(IBAction)doneButtonPressed:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

#pragma mark -
#pragma mark UIWebViewDelegate

- (void)webViewDidStartLoad:(UIWebView *)aWebView {
    [activityIndicator startAnimating];
    backButton.enabled = webView.canGoBack;
    forwardButton.enabled = webView.canGoForward;
}
- (void)webViewDidFinishLoad:(UIWebView *)aWebView {
    [activityIndicator stopAnimating];
    backButton.enabled = webView.canGoBack;
    forwardButton.enabled = webView.canGoForward;
    pageTitle.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}

任何人都可以阐明这一点吗?

最佳答案

我会检查您的 ivars,因为它会向我暗示某些东西已被释放,并且您正在尝试对 nil 对象/指针执行操作。

关于iphone - SendDelegateMessage 等待10秒后返回失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4653893/

相关文章:

ios - 如果我的应用程序用作内容交易平台并使用 Paypal,我的应用程序会被拒绝吗?

ios - iPhone 在表格 View 项目上单击打开多个 View Controller

ios - 即使重新安装后,数据仍保留在 iPhone 上

iOS 多重登录 Dropbox 帐户

ios - 如何使用 Storyboard为不同设备设置自动布局

ios Restkit - 将对象与另一个列表中的列表映射

iOS - 为多个 uilocalnotification 打开多个相同的 View Controller

iphone - 将字符串值从 C 函数传递到 Xcode 中的目标代码

ios - Objective-C 属性无限循环

ios - 如何将我的 UITableViewController 中的每个项目推送到单个 UIViewController