Objective c IOS6上的NSDATE组件不工作?

Objective c IOS6上的NSDATE组件不工作?,objective-c,ios,ios6,exc-bad-access,nsdatecomponents,Objective C,Ios,Ios6,Exc Bad Access,Nsdatecomponents,我有一个使用IOS4和ios5的简单程序。 现在使用IOS 6时,我收到以下错误消息: 2012-10-05 11:08:16.386 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:18.072 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-05 11:08:19.273 app[1698:19d03] 2012-10-05 09:08:11 +0000 2012-10-

我有一个使用IOS4和ios5的简单程序。 现在使用IOS 6时,我收到以下错误消息:

2012-10-05 11:08:16.386 app[1698:19d03] 2012-10-05 09:08:11 +0000
2012-10-05 11:08:18.072 app[1698:19d03] 2012-10-05 09:08:11 +0000
2012-10-05 11:08:19.273 app[1698:19d03] 2012-10-05 09:08:11 +0000
2012-10-05 11:08:19.274 app[1698:19d03] 2012-10-05 09:08:11 +0000
2012-10-05 11:08:19.275 app[1698:19d03] 0
2012-10-05 11:08:25.055 app[1698:19d03] 2011-10-05 09:08:11 +0000
2012-10-05 11:08:25.823 app[1698:19d03] (
"<UILongPressGestureRecognizer: 0xa167f60; state = Possible; view = <UITableViewCellContentView 0xa168000>; target= <(action=_longPressGestureRecognized:, target=<UIPickerTableViewWrapperCell 0xa168090>)>>")
2012-10-05 11:08:25.824 app[1698:19d03] 2012-10-05 09:08:11 +0000
2012-10-05 11:08:25.824 app[1698:19d03] -[__NSArrayI timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x94ef5d0
2012-10-05 11:08:25.825 app[1698:19d03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x94ef5d0'
*** First throw call stack:
(0x1d16012 0x11fae7e 0x1da14bd 0x1d05bbc 0x1d0594e 0x1d25cd3 0xa092 0x120e705 0x145920 0x1458b8 0x206671 0x206bcf 0x205d38 0x17533f 0x175552 0x1533aa 0x144cf8 0x1f4fdf9 0x1f4fad0 0x1c8bbf5 0x1c8b962 0x1cbcbb6 0x1cbbf44 0x1cbbe1b 0x1f4e7e3 0x1f4e668 0x14265c 0x296d 0x28a5)
谢谢你的帮助

我换了

NSDateComponents *comps = [gregorian components:NSMonthCalendarUnit fromDate:startDate toDate:endDate options:0];


现在它开始工作:)。

不提供控制台消息和代码图片的链接,而是将文本放在问题本身中。@user806544欢迎使用堆栈溢出。在可能的情况下,我们希望问题是独立的。请编辑您的问题,以直接包含代码和输出,而不是作为pastebin链接。您好,对不起,这里是第一个问题。编辑了这个问题,希望这样可以。为什么要创建指向日期的额外指针(而不是重新定义
选定的
变量)。因为我只是复制粘贴了这个示例,而我懒得更改startDate和endDate变量:\。
NSDateComponents *comps = [gregorian components:NSMonthCalendarUnit fromDate:startDate toDate:endDate options:0];
NSInteger months = [[[NSCalendar currentCalendar] components: NSMonthCalendarUnit
                                                    fromDate: startDate
                                                      toDate: endDate
                                                     options: 0] month];