我使用Core Data遇到了这个问题。
CoreData: error: exception during fetchRowForObjectID: -[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920 with userInfo of (null)
2014-08-18 07:56:55.784 HorizonMemory[1357:60b] CoreData: error: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. -[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920 with userInfo (null)
2014-08-18 07:56:55.786 HorizonMemory[1357:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PharmaceuticalComp initWithCoder:]: unrecognized selector sent to instance 0x9ab1920'
*** First throw call stack:
(
0 CoreFoundation 0x021981e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01f178e5 objc_exception_throw + 44
2 CoreFoundation 0x02235243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0218850b ___forwarding___ + 1019
4 CoreFoundation 0x021880ee _CF_forwarding_prep_0 + 14
5 Foundation 0x01b2a01a _decodeObjectBinary + 3498
6 Foundation 0x01b2b4d7 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 2204
7 Foundation 0x01b2b746 -[NSArray(NSArray) initWithCoder:] + 255
8 Foundation 0x01b2a01a _decodeObjectBinary + 3498
9 Foundation 0x01b2b4d7 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 2204
10 Foundation 0x01b37ff1 -[NSDictionary(NSDictionary) initWithCoder:] + 261
11 Foundation 0x01b2a01a _decodeObjectBinary + 3498
12 Foundation 0x01b29106 _decodeObject + 340
13 Foundation 0x01b28faa -[NSKeyedUnarchiver decodeObjectForKey:] + 181
14 Foundation 0x01b9aa86 +[NSKeyedUnarchiver unarchiveObjectWithData:] + 106
15 Foundation 0x01b197d5 -[_NSKeyedUnarchiveFromDataTransformer transformedValue:] + 47
16 CoreData 0x024205b9 _prepareResultsFromResultSet + 4105
17 CoreData 0x0241de33 newFetchedRowsForFetchPlan_MT + 1
PharmaComp是一个NSManaged子类,通过瞬态属性User
链接到另一个实体-linkedPharma
。用户在只读模式下具有此属性。每次我调用linkedPharma时,它都会启动一个提取请求,为我提供PharmaComp实例。当我尝试删除用户时,我得到了这个例外。奇怪的事实是,LinkedPharma是一个未在模型中列出的属性,因此PharmaComp不应该参与任何类型的操作。另一个事实是它似乎尝试使用NSKeyedUnarchivier,但我不是&#39不明白为什么。
NSManagedObjectContextObjectsDidChangeNotification
没有听到任何对象。
我不知道它来自哪里。
答案 0 :(得分:1)
解决方案非常简单
用户还有一个与可转换容器(NSArray)的另一个关系,该容器持有(一个bug)一个PharmaComp实例。