- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我的应用程序中发生了崩溃,这种崩溃很少发生(可能每 30 次运行一次)。错误代码包含一个奇怪的选择器名称 _nilOutReservedCurrentEventSnapshot__
我根本找不到任何文档。这是来自我的控制台的提要:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType _nilOutReservedCurrentEventSnapshot__]: unrecognized selector sent to instance 0x157b51e0'
*** First throw call stack:
(0x2358810b 0x22d2ee17 0x2358d925 0x2358b559 0x234bbc08 0x24cbf445 0x24ca4d99 0x249bec 0x245c90 0x19b68c 0x24a5c97 0x24b05ab 0x24a8ef9 0x24b1a8d 0x24b18e7 0x232bfb29 0x232bf718)
libc++abi.dylib: terminating with uncaught exception of type NSException
最佳答案
不幸的是,您找不到关于 _nilOutReservedCurrentEventSnapshot__
的太多信息。
在线的..
它可能与托管对象的快照生命周期有关。
When Core Data fetches an object from a persistent store, it takes a snapshot of its state. A snapshot is a dictionary of an object’s persistent properties—typically all its attributes and the global IDs of any objects to which it has a to-one relationship. Snapshots participate in optimistic locking. When the framework saves, it compares the values in each edited object’s snapshot with the then-current corresponding values in the persistent store.
_nilOutReservedCurrentEventSnapshot__
没有记录意味着这种行为不应该发生。
NSManagedObject
的函数。类(class)。
unrecognized selector sent to instance
是因为
_nilOutReservedCurrentEventSnapshot__
在不是
NSManagedObject
的对象上被调用,因为
NSManagedObject
被释放,其他东西现在填满了它的内存。这是事实。
If you use more than one managed object context in an application, Core Data does not automatically notify one context of changes made to objects in another. In general, this is because a context is intended to be a scratch pad where you can make changes to objects in isolation, and you can discard the changes without affecting other contexts.
retainsRegisteredObjects
子上下文的属性为
true
在获取 ManagedObjects 之前(然后在保存上下文后设置为 false 以避免进一步潜在的内存泄漏)。
warning!
ctx.retainsRegisteredObjects = true
Consider an application with two managed object contexts and a single persistent store coordinator. If a user deletes an object in the first context (moc1), you may need to inform the second context (moc2) that an object has been deleted. In all cases, moc1 automatically posts an NSManagedObjectContextDidSaveNotification notification via the NSNotificationCenter that your application should register for and use as the trigger for whatever actions it needs to take. This notification contains information not only about deleted objects, but also about changed objects. You need to handle these changes because they may be the result of the delete. Most of these types of changes involve transient relationships or fetched properties.
objectWithID
在上下文之间传递 ManagedObjects 时。 NSManagedObjectContextDidSaveNotification
对对象更改采取适当的措施扳机。 ManagedObject
的位置。使用仪器中的僵尸分析解除分配。
If a message is then sent to one of these deallocated objects (which are now NSZombie objects), the zombie is flagged, the app crashes, recording stops, and a Zombie Messaged dialog appears. You can then examine the retain and release history of the zombie object to determine exactly where the problem occurred.
关于ios - 罕见的 CoreData 崩溃 "nilOutReservedCurrentEventSnapshot",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35717135/
我有一个 SearchBar,它更新某个 Binding 字符串,该字符串是地理编码的潜在位置匹配列表。有时,当我输入一个位置时,我会得到以下信息: libswiftCore.dylib`_swift
我是一名优秀的程序员,十分优秀!