开发者

NSManagedObjectContext returns YES for hasChanges when there are none

I created a separate NSManagedObjectContext on a separate thread to perform some store maintenance. However, I have noticed that the context returns YES for hasChanges as soon as 开发者_开发问答a managed object in it is even referenced e.g.

NSString *name = managedObject.name;

This context is created and used exclusively in 1 method. Why is it returning has changes, when there there are none?


That ks difficult to answer without seeing the code. Perhaps your object has a -awakeFromFetch call that touches a property or something else. Normally there should be no changes from just fetching an object unless you are doing something to that object either in the awakeFromFetch or somewhere else in your code.

update

Before the save, grab the deleted array, updated array and inserted array and take a peek at them. That will give you a hint as to what is going on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜