Adding/removing managed objects: how to know the maximum index?
Adding/removing managed objects: how to know the maximum index?
- Subject: Adding/removing managed objects: how to know the maximum index?
- From: Arthur C. <email@hidden>
- Date: Wed, 14 Nov 2007 23:47:49 +0100
- Importance: Normal
My Core Data managed objects (instances) all have their own index. Naturally, when I add an object, I want to set its index to the highest index value so far, + 1. This should be done in - awakeFromInsert.
However, when I perform a fetch request from there, a second (new) item appears in the table (instead of just one). This can't be right.
So, the question is how to keep track of the maximum index in a correct way.
Should I maintain a class variable for the maximum index (updated on awakeFromFetch / -Insert)? If so, how do I keep track of removed objects (say when the object with the highest index gets removed)?
Suggestions appreciated.
Best regards,
Arthur C.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden