如何findNSInvalidArgumentException(“数据参数为零”)抛出?

我正在写一个iPad应用程序,今天我意识到,没有互联网连接时有什么问题。

我得到这个非常丰富的错误:

***由于未捕获的exception“NSInvalidArgumentException”终止应用程序,原因:'数据参数为零'

我想,我只限于这个片段:

@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得到打印,并且两个variables都存在。 但是第二个也不是第三个(在第一个之后应该被称为)被打印。

任何想法,如何继续?

在XCode中,您可以添加Exception-Breakpoint,这会在应用程序崩溃前暂停应用程序。 你应该试试这个,如果它应该如此,它会暂停在代码行上,使应用程序崩溃。

如何添加exception断点

使用弹簧3版本

Springconfiguration:springService.xml

 <context:component-scan base-package=" com.service.impl" /> <!-- Scheduler : Initial delay =5 minutes (5*60000 seconds) and repeat interval= 5 minutes--> <task:annotation-driven executor="myExecutor" scheduler="myScheduler" /> <task:executor id="myExecutor" pool-size="1" /> <task:scheduler id="myScheduler" pool-size="1" /> <task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="batchUpdateServiceImpl" method="updateMe" fixed-delay="300000" initial-delay="300000"/> <task:scheduled ref="batchUpdateServiceImpl" method="updateYou" fixed-delay="300000" initial-delay="300000"/> </task:scheduled-tasks> Package Code : com.service.impl Class Name: @Service public class BatchUpdateServiceImpl { public void updateMe(){ System.out.println(“update me”); } public void updateYou(){ System.out.println(“update You”); } } Web.xml : <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/springService.xml </param-value> </context-param>