How to find where NSInvalidArgumentException (“data parameter is nil”) get's thrown?

匿名 (未验证) 提交于 2019-12-03 02:41:02

问题:

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:

*** 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 

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.

Any ideas, how to go on?

回答1:

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.

How to add the exception-breakpoint



回答2:

Use spring 3 version

Spring configuration : 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> 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!