NSRefreshedObjectsKey的目的 [英] Purpose of NSRefreshedObjectsKey

查看:91
本文介绍了NSRefreshedObjectsKey的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSManagedObjectContextObjectsDidChangeNotification通知中,有时我会得到NSRefreshedObjectsKey键.

In a NSManagedObjectContextObjectsDidChangeNotification notification, I sometimes get the NSRefreshedObjectsKey key.

我了解

I understand refreshed objects to be a new fetch of the object from the persistent store/cache.

什么原因导致通知随后返回刷新的对象?对于插入,更新,删除等,这很明显,但是我必须对对象执行什么操作才能使其出现在NSRefreshedObjectsKey键中?例如.是只是通过某种方式(将相同的值写入相同的键)进行了触摸?

What causes the notification to return refreshed objects then? For inserted, updated, deleted, etc it is obvious, but what must I do to an object for it to appear in the NSRefreshedObjectsKey key? E.g. is it that it may have simply been touched in some way (same values written to same keys)?

推荐答案

如果调用'-(void)refreshObject:(NSManagedObject *)object mergeChanges:(BOOL)flag '在对象上,该对象将包含在刷新的对象中.

if you call '- (void)refreshObject:(NSManagedObject *)object mergeChanges:(BOOL)flag ' on an object, that object wud be included in refreshed objects.

我们使用了多个线程管理对象上下文,并且在合并bg上下文中的更改之前, 我们使用"existingObject"实现所有已更改的对象.这也会导致这些对象被包括在内 "NSRefreshedObjectsKey"键.

we use multiple threaded managedobject contexts, and before merging the changes from bg context, we realize all changed objects using 'existingObject'. This also causes these objects to be included for 'NSRefreshedObjectsKey' key.

这篇关于NSRefreshedObjectsKey的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆