Kal Calendar crashes on ViewWillAppear

127 Views Asked by At

I'm using a Kal Calendar in my app. However my app crashes when the Kal ViewWillAppear is called. Here is my code.

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    KalViewController *calendar = [[KalViewController alloc] init];
    [self.navigationController pushViewController:calendar animated:YES];
    calendar.dataSource = self;
    [calendar reloadData];
    self.tabBarController.delegate = self;
}

I used breakpoints and my app is crashing at:

[calendar reloadData];

Here is the error message from the debugger

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil' * First throw call stack: (0x2088012 0x156ae7e 0x203bb6a 0x203ba20 0x10c1b 0x1ca08 0x11088 0x282103 0x28242b 0x297fad 0x29889b 0x2989b9 0x298a45 0x39e20b 0x1ef2dd 0x157e6b0 0x72d4fc0 0x72c933c 0x72d4eaf 0x28e2bd 0x1d6b56 0x1d566f 0x1d5589 0x1d47e4 0x1d461e 0x1d53d9 0x1d82d2 0x28299c 0x1cf574 0x1cf76f 0x1cf905 0x1d8917 0x2580 0x19c157 0x19c747 0x19d94b 0x1aecb5 0x1afbeb 0x1a1698 0x22c1df9 0x22c1ad0 0x1ffdbf5 0x1ffd962 0x202ebb6 0x202df44 0x202de1b 0x19d17a 0x19effc 0x227d 0x21a5) libc++abi.dylib: terminate called throwing an exception (lldb)

By the way the my app only crashes when I have some data to insert in the calendar.

1

There are 1 best solutions below

0
On BEST ANSWER

I found the answer! I was getting a date from Core Data but the formatter was wrong and the date was coming out as nil.