保存核心數據上下文時,出現以下錯誤。 我真的不知道從哪裏開始看,如果你有一個領導... 謝謝。CoreData誤解對象類
PS:我檢查了.h文件中聲明的所有類型與我的數據模型中的相同。
編輯:我覆蓋了NSDate類intValue。現在我看到timeIntervalSinceReferenceDate在NSNumber上被調用。我試圖在那裏放置一個斷點,但它沒有提供任何信息(只保存:在我的代碼之前)。我還發現了一種方法來知道誰是那些着名的對象:NSDate是一個對象(稱爲lastCompute)與NSNumber(稱爲sleep)在同一個類中。它們的類型匹配在.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
一些代碼在哪裏實際上可以節省? – Eimantas
是的,沒有人可以真正解釋這個以及代碼。 – darksky
- [__ NSDate intValue]:無法識別的選擇器SAYS IT ALL。 NSDate對象沒有intValue函數。 – Zigglzworth