如何找到NSInvalidArgumentException(“数据参数是nil”)得到抛出? [英] How to find where NSInvalidArgumentException ("data parameter is nil") get's thrown?

查看:563
本文介绍了如何找到NSInvalidArgumentException(“数据参数是nil”)得到抛出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个iPad应用程序,今天我意识到,没有互联网连接时出错了。

I'm writing an iPad App and today I realized, that there's something wrong when there's no internet connection.

我得到这个非常信息性的错误:

I get this very informative error:


***由于未捕获异常NSInvalidArgumentException而终止应用程序,原因:数据参数为nil

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

我认为,我把它限制在这个片段:

I think, I limited it to this snippet:

@implementation WebviewPanelFactory

- (WebviewPanelViewController *)webviewPanelForSection:(NSDictionary *)section {
    WebviewPanelViewController *webviewPanel = [[WebviewPanelViewController new] initWithNibName:@"WebviewPanel" bundle:nil];
    webviewPanel.sectionTitle = section[@"Title"];

    NSLog(@"HERE I AM. %@ %@", webviewPanel, section);

    [self setupURLsForWebview:webviewPanel withSection:section];

    NSLog(@"HERE I STILL AM");

    [webviewPanel initWebviewPanel];
    return webviewPanel;
}

- (void)setupURLsForWebview:(WebviewPanelViewController *)webviewPanel withSection:(NSDictionary *)section {

    NSLog(@"HERE I AM. %@", section);

    ...
}

@end

第一个NSLog get的打印和两个变量确实存在。

The first NSLog get's printed and both variables do exist. But neither the second one, nor the third one (which should be called right after the first one) gets printed.

任何想法,如何继续?

推荐答案

在XCode中,您可以添加异常断点,它会在崩溃致命之前暂停应用程序。你应该给这个试试,如果它的工作原理,它会在代码行上暂停,这会崩溃你的应用程序。

In XCode you can add the Exception-Breakpoint which will halt the application right before it crashes fataly. You should give this one a try, if it works as it should, it will pause right on the line of code, that crashes your app.

如何添加异常 - 断点

这篇关于如何找到NSInvalidArgumentException(“数据参数是nil”)得到抛出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆