• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Adding/removing managed objects: how to know the maximum index?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread 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

  • Follow-Ups:
    • Re: Adding/removing managed objects: how to know the maximum index?
      • From: Jim Correia <email@hidden>
    • Re: Adding/removing managed objects: how to know the maximum index?
      • From: Sachin Kumar Tulla <email@hidden>
    • Re: Adding/removing managed objects: how to know the maximum index?
      • From: Sachin Kumar Tulla <email@hidden>
    • Re: Adding/removing managed objects: how to know the maximum index?
      • From: David Spooner <email@hidden>
  • Prev by Date: Handling system clock changes in 64-bit apps
  • Next by Date: RE: How to observe Core Data add/remove actions?
  • Previous by thread: Handling system clock changes in 64-bit apps
  • Next by thread: Re: Adding/removing managed objects: how to know the maximum index?
  • Index(es):
    • Date
    • Thread