• 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
RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert


  • Subject: RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert
  • From: "Jon C. Munson II" <email@hidden>
  • Date: Thu, 19 Mar 2009 10:09:53 -0400
  • Organization: JTA Enterprises LLC

Namaste!

Thank you for your answer.

I did some digging and found that the real issue is the call for
processPendingChanges that apparently is called via the executeFetch.
According to what I read this is standard behavior.

So, I'd have to say it isn't a "bug" in this case.

Relative to the performSelector you suggested, I am not able to locate a
sample that shows how to use that in conjunction with awakeFromFetch in
order to do what I'd like.  Do you know of a sample somewhere that shows
such use?

Also, would a better solution be to create a custom -addEntity method that
fetches the next value, then calls the NSArrayController's add (or a more
relevant -add), then updates the relevant attribute?

To me it makes far more sense to put such stuff in the awakeFromInsert, so
I'd consider the above a kludge, however, if that, in this case, is what
needs doing...

Many thanks in advance!

Peace, Love, and Light,

/s/ Jon C. Munson II

> -----Original Message-----
> From: Sean McBride [mailto:email@hidden]
> Sent: Wednesday, March 18, 2009 12:17 PM
> To: email@hidden; 'Cocoa Developers'
> Subject: Re: [Q] "auto"-incrementing integer attribute in awakeFromInsert
>
> On 3/18/09 11:52 AM, Jon C. Munson II said:
>
> >What happens is the attribute is set with the correctly incremented
> number.
> >However, the tableview that is used to manage this entity displays two
> rows
> >every time a new entity is inserted.
>
> Fetching from awakeFromInsert is discouraged.  There are some bugs/
> problems.  If you have an NSArrayController that will make use of the
> object you're inserting (seems to be your case), it will receive
> duplicate KVO notifications.  Please file a bug with a repro case to
> Apple.
>
> >So, my question is, how do I resolve the two-row error, or, is there a
> >better way?
>
> You're best bet is using performSelector:withObject:afterDelay: in
> awakeFromInsert, that way you're not fetching in awakeFromInsert.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 email@hidden
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: [Q] "auto"-incrementing integer attribute in awakeFromInsert
      • From: "Sean McBride" <email@hidden>
    • RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert
      • From: "Jon C. Munson II" <email@hidden>
References: 
 >[Q] "auto"-incrementing integer attribute in awakeFromInsert (From: "Jon C. Munson II" <email@hidden>)
 >Re: [Q] "auto"-incrementing integer attribute in awakeFromInsert (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: [Q] Contextual Menu Items Size
  • Next by Date: RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert
  • Previous by thread: Re: [Q] "auto"-incrementing integer attribute in awakeFromInsert
  • Next by thread: RE: [Q] "auto"-incrementing integer attribute in awakeFromInsert
  • Index(es):
    • Date
    • Thread