开发者

Am I permitted to change the object graph in NSManagedObjectContextObjectsDidChangeNotification?

I'd like to know when an object has been inserted into my Core Data MOC and when it has, add it to another object with a relationship.

So I watch the NSManagedObjectContextObjectsDidChangeNotification notifications find all the objects of the correct class in the set of i开发者_如何学Gonserted objects and make the connection using addObject so that the KVO is handled correctly. It appears to work just fine.

Is this legal inside NSManagedObjectContextObjectsDidChangeNotification?


That is perfectly legal, you just need to be careful when you do things like this that you don't cause infinite recursion (by, for instance, inserting an object that cause a notification the causes you to add an object, etc).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜