如何使NSManagedObjectContext脏(hasChanges = YES)手动 [英] how to make NSManagedObjectContext dirty (hasChanges = YES) Manually

查看:158
本文介绍了如何使NSManagedObjectContext脏(hasChanges = YES)手动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是:
- (void)中设置transient undefined属性didSave metod在第一个之后 save:在iOS 4.3(模拟器)中不会使上下文脏,但是在iOS 5.0模拟器中使它变脏。



我需要在iOS 4.3中的相同行为。 p>

那么,在2 (BOOL)save:调用之间做上下文的最便宜的方法是什么。



再次 - 在iOS 5中,在 - (void)didSave 中设置transient属性会使上下文脏,但在ios 4.3上不是。 / p>

和更多 - 我需要使所有在 didSave 方法脏中更改的对象

$您是否尝试过对NSManagedObjectContext进行子类化,并为hasChanges属性或类似属性返回true?


the problem is: while setting transient undefined attribute in -(void)didSave metod after first save: does not make context dirty in iOS 4.3 (Simulator), but makes it dirty in iOS 5.0 Simulator.

I need the same behaviour in iOS 4.3.

So - what is the cheapest way to make context dirty between 2 (BOOL)save: calls.

Once again - in iOS 5 setting transient attribute in -(void)didSave makes context dirty, but on ios 4.3 not.

and more - I need to make all objects that were changed in didSave method "dirty"

解决方案

Have you tried subclassing NSManagedObjectContext and returning true for the hasChanges property or similar?

这篇关于如何使NSManagedObjectContext脏(hasChanges = YES)手动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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