How to find where NSInvalidArgumentException (“dat

2020-05-03 12:45发布

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?

2条回答
趁早两清
2楼-- · 2020-05-03 13:24

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

查看更多
聊天终结者
3楼-- · 2020-05-03 13:46

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>
查看更多
登录 后发表回答