UIWebView&导航控制器在加载时崩溃

时间:2012-09-26 23:23:33

标签: objective-c uiwebview uinavigationcontroller drilldown

我有非常奇怪的问题

我使用UIWebView和NavigationController构建一个简单的应用程序,但问题是当秒页面加载时我回到第一页并访问了一个链接APP崩溃而控制台什么也没说

这是关于完成加载的代码

-(void)webViewDidFinishLoad:(UIWebView *)aWebView {
    NSString *str = [aWebView stringByEvaluatingJavaScriptFromString:@"document.title"];
    self.navigationItem.title = str; 
     [navigationActivity stopAnimating];
}

这对于Web视图应该开始加载

if(navigationType == UIWebViewNavigationTypeOther)
    {
        NSURL *url2 = [request URL];
        NSString *URLStr = [url2 absoluteString];

        RootViewController* viewController = [[RootViewController alloc] init];
        NSString *holder = [self getQueryStringInner:URLStr];
        [self getQueryString:URLStr];
        if([holder length] != 0 && [flag length] != 0 && !facebook )
        {

            appDelegate.title =@"Title"; 
            appDelegate.query = queryString;
            appDelegate.url = holder; 

            [self.navigationController pushViewController:viewController animated:YES];
            [viewController release];
            return NO;
        }
}

我是Objective-c和iOS开发的新手,所以任何帮助都将受到赞赏

任何帮助

1 个答案:

答案 0 :(得分:2)

似乎必要的步骤是在viewWillDisappear中调用[webView stopLoading]。显然,Web视图委托将webViewDidFinishLoading方法消息发送到解除分配的实例。很高兴你得到了它。