简体   繁体   English

Kal Calendar在ViewWillAppear上崩溃

[英]Kal Calendar crashes on ViewWillAppear

I'm using a Kal Calendar in my app. 我在我的应用程序中使用Kal日历。 However my app crashes when the Kal ViewWillAppear is called. 但是,当调用Kal ViewWillAppear时,我的应用程序崩溃了。 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) *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'* -[__ NSArrayM insertObject:atIndex:]:对象不能为零' *首次抛出调用堆栈:(0x2088012 0x156ae7e 0x203bb6a 0x203ba20 0x10c1b 0x1ca08 0x11088 0x282103 0xb2b2242 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:终止称为抛出异常( lldb)

By the way the my app only crashes when I have some data to insert in the calendar. 顺便说一句,我的应用程序仅在我有一些数据要插入日历时崩溃。

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. 我从Core Data获取日期,但是格式化程序错误,日期显示为nil。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM