Purpose of NSRefreshedObjectsKey

南笙酒味 提交于 2019-12-08 02:20:33

问题


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.

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)?


回答1:


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

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.



来源:https://stackoverflow.com/questions/12744328/purpose-of-nsrefreshedobjectskey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!