gpt4 book ai didi

iphone - 当被管理对象出现故障时,如何正确处理KVO通知?

转载 作者:行者123 更新时间:2023-12-03 19:05:09 24 4
gpt4 key购买 nike

来自docs :

When Core Data turns an object into a fault, key-value observing (KVO) change notifications (see Key-Value Observing Programming Guide) are sent for the object’s properties. If you are observing properties of an object that is turned into a fault and the fault is subsequently realized, you receive change notifications for properties whose values have not in fact changed.

那么,如果一个对象出现故障,Core Data 是否会针对更改的属性发送 KVO 通知?因此,在对通知感到满意之前,我必须始终检查 isFault == NO 吗?

最佳答案

isFault 不可靠,因为发送 KVO 通知时 isFault 可能仍返回 NO。人们应该检查 faultingState 来了解这一点:

faultingState Returns a value that indicates the faulting state of the receiver.

  • (NSUInteger)faultingState Return Value 0 if the object is fully initialized as a managed object and not transitioning to or from another state, otherwise some other value.

Discussion The method allow you to determine if an object is in a transitional phase when receiving a key-value observing change notification.

关于iphone - 当被管理对象出现故障时,如何正确处理KVO通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3032084/

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