gpt4 book ai didi

ios - 核心数据异常: initWithCoder:]: unrecognized selector sent

转载 作者:行者123 更新时间:2023-11-29 02:44:05 30 4
gpt4 key购买 nike

我在使用 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 子类,通过 transient 属性 -linkedPharma 链接到另一个实体 User。用户在只读模式下拥有此属性。每次我调用 linkedPharma 时,它都会启动一个获取请求,为我提供 PharmaComp 实例。当我尝试删除用户时,出现此异常。奇怪的是 linkedPharma 是模型中未列出的属性,因此 PharmaComp 不应参与任何类型的操作。另一个事实是它似乎尝试在其上使用 NSKeyedUnarchivier,但我不明白为什么.
没有对象听到 NSManagedObjectContextObjectsDidChangeNotification
我不知道它来自哪里。

最佳答案

解决方案非常简单。
用户还与可变形容器 (NSArray) 存在另一种关系,该容器保存(针对错误)PharmaComp 实例。

关于ios - 核心数据异常: initWithCoder:]: unrecognized selector sent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25357446/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com