ios - 什么是 "Faulting"行为?

标签 ios core-data fault

谁能给我解释一下“fault”的意思?

这里是来自 Apple 核心数据性能文档的“故障行为”文档。

Faulting Behavior

Firing faults can be a comparatively expensive process (potentially requiring a round trip to the persistent store), and you may wish to avoid unnecessarily firing a fault. You can safely invoke the following methods on a fault without causing it to fire: isEqual:, hash, superclass, class, self, zone, isProxy,isKindOfClass:, isMemberOfClass:, conformsToProtocol:, respondsToSelector:, description, managedObjectContext, entity, objectID, isInserted, isUpdated, isDeleted, and isFault.

Since isEqual and hash do not cause a fault to fire, managed objects can typically be placed in collections without firing a fault. Note, however, that invoking key-value coding methods on the collection object might in turn result in an invocation of valueForKey: on a managed object, which would fire a fault. In addition, although the default implementation of description does not cause a fault to fire, if you implement a custom description method that accesses the object’s persistent properties, this will cause a fault to fire.

Note that just because a managed object is a fault, it does not necessarily mean that the data for the object are not in memory—see the definition for isFault.

谢谢!!

最佳答案

一般而言,错误 是对您引用某些数据但该数据实际上不在内存中的情况的描述(因此它不是立即可用的,需要从其他地方获取)。

因此,您有一个托管对象实例,但您只能对其调用几个方法,而不会导致收集额外数据并将其加载到内存中。

关于ios - 什么是 "Faulting"行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17429762/

相关文章:

ios - 属性访问结果未使用但 NSLog 工作正常

ios - 更流畅的手绘体验(iOS)

ios - 输出相机帧缓冲区不会出现

ios 如何在核心数据中的实体中添加事件?

ios - Cocoapods 1.13.0 未正确安装

iphone - 托管对象上下文保存失败怎么办?

ios - 如何获取 NSManagedObjectId 并检索数据

c - 评论 2 免费时出现段错误(推箱子游戏)

ios - NSManagedObject - 关系错误

c - ubuntu 中 C 的段错误(核心转储)