Core Data无法识别的选择器异常保存 [英] Unrecognized selector exception with Core Data save
问题描述
这是一个长镜头,因为google搜索绝对没有返回。有时,经常是足够的地方,它值得进一步调查,但不足够的地方,我可以跟踪什么时候或它是如何发生,我得到以下异常,当我调用 save:
NSManagedObjectContext
:
- [_ NSObjectID_48_0 _stateFlags]:无法识别的选择器发送到实例0x8675570
上下文是一个子上下文,类型为 NSPrivateQueueConcurrencyType
,它是类型 NSMainQueueConcurrencyType
的主上下文的子类。
我真的没有任何堆栈跟踪之外的更多信息:
任何加密技术人员都可以从堆栈跟踪中找出任何可能的问题来解决问题。
日志消息表明由于某种原因,我们在 _NSObjectID_48_0
_stateFlags >
快速运行
p> class-dump /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
以指示 _stateFlags
是 NSManagedObject
上的私有API。我在我的Mac上找不到任何引用一个名为 _NSObjectID_48_0
的私人类,但是基于名称,它似乎与 NSManagedObjectID
。
这是一个长镜头,但我想知道你是否在某个时候通过了 NSManagedObjectID
其中 NSManagedObject
是否是预期的?它不会伤害你的代码显式强制到 NSManagedObject
。
另一个原因可能是将NSManagedObjectIDs插入一个弱类型的数据结构(我在看你的字典/数组/集合),这可能允许你强制到NSManagedObject而不是明确的。
This is a long shot, since a google search returns absolutely nothing on this. Sometimes, often enough where it merits further investigation but not often enough where I can track down when or how exactly it happens, I get the following exception when I call save:
on a NSManagedObjectContext
:
-[_NSObjectID_48_0 _stateFlags]: unrecognized selector sent to instance 0x8675570
The context is a child context with type NSPrivateQueueConcurrencyType
, which is a child of the main context with type NSMainQueueConcurrencyType
.
I really don't have any further information other than the stack trace:
Can any cryptographers make anything out of the stack trace to conjure up some possible ideas as to what the problem could be?
The log message indicates that for some reason we are looking for the property/method _stateFlags
on _NSObjectID_48_0
, one of which is a private API, and the other is a private class.
A quick run of
class-dump /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
seems to indicate that (among other places) _stateFlags
is a private API on NSManagedObject
. I can't find any reference to a private class named _NSObjectID_48_0
on my Mac, but based on name alone it seems related to NSManagedObjectID
.
This is a long shot, but I am wondering if you have at some point passed an NSManagedObjectID
where an NSManagedObject
was expected instead? It can't hurt to grep your code for explicit coercions to NSManagedObject
.
Another culprit might be inserting NSManagedObjectIDs into a weakly-typed datastructure (dictionaries/arrays/sets I'm looking at you) which might allow you to "coerce" to NSManagedObject without being explicit about it.
这篇关于Core Data无法识别的选择器异常保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!