【发布时间】:2011-11-17 05:41:08
【问题描述】:
保存我的核心数据上下文时,出现以下错误。 我真的不知道从哪里开始看,如果你甚至有线索...... 谢谢。
PS:我检查了 .h 文件中声明的所有类型都与我的数据模型中的相同。
编辑:我在 NSDate 类别中覆盖了 intValue。现在我看到在 NSNumber 上调用了 timeIntervalSinceReferenceDate。我试图在那里放置一个断点,但它没有提供任何信息(仅保存:在我的代码之前)。我还找到了一种方法来知道谁是那些著名的对象:NSDate 是与 NSNumber(称为 sleep)在同一类中的对象(称为 lastCompute)。它们的类型与 .h 中声明的类型和数据模型相匹配。但它并没有给我暗示为什么 CoreData 在 NSDate 上调用 intValue。有铅吗?谢谢
-[__NSDate intValue]: unrecognized selector sent to instance 0x6a3cba0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDate intValue]: unrecognized selector sent to instance 0x6a3cba0'
*** Call stack at first throw:
(
0 CoreFoundation 0x01ca35a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01df7313 objc_exception_throw + 44
2 CoreFoundation 0x01ca50bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01c14966 ___forwarding___ + 966
4 CoreFoundation 0x01c14522 _CF_forwarding_prep_0 + 50
5 CoreData 0x00955b50 -[NSSQLiteConnection execute] + 2320
6 CoreData 0x009a7ebd -[NSSQLiteConnection updateRow:] + 365
7 CoreData 0x009a6e64 -[NSSQLConnection performAdapterOperations:] + 180
8 CoreData 0x009a6b0e -[NSSQLCore _performChangesWithAdapterOps:] + 494
9 CoreData 0x009a55ea -[NSSQLCore performChanges] + 410
10 CoreData 0x0099f038 -[NSSQLCore saveChanges:] + 216
11 CoreData 0x0095d199 -[NSSQLCore executeRequest:withContext:error:] + 409
12 CoreData 0x00a0d70b -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 3691
13 CoreData 0x00995948 -[NSManagedObjectContext save:] + 712
【问题讨论】:
-
一些你实际保存的代码怎么样?
-
是的,没有人能像代码一样真正解释这一点。
-
-[__NSDate intValue]:无法识别的选择器说明了一切。 NSDate 对象没有 intValue 函数。
-
我的问题是:我找不到这个 NSDate 在哪里(因此核心数据需要 NSNumber )。 @Eimantas / Nayefc:我的代码没有什么花哨的,只是有很多类,所以我不能在这里复制它。你会在代码中搜索什么?
-
你还认为你需要更多代码吗?
标签: iphone objective-c core-data