• 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: Triggering a Method when a Core Data Property is Altered.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Triggering a Method when a Core Data Property is Altered.


  • Subject: Re: Triggering a Method when a Core Data Property is Altered.
  • From: Joshua Garnham <email@hidden>
  • Date: Wed, 7 Oct 2009 10:22:08 -0700 (PDT)

Hi,

That works now, Thanks Very Much!!!

Josh.


________________________________
From: Volker in Lists <email@hidden>
To: Joshua Garnham <email@hidden>
Cc: email@hidden
Sent: Wednesday, 7 October, 2009 18:04:59
Subject: Re: Triggering a Method when a Core Data Property is Altered.

Hi,

awakeFromFetch is only called when the object is loaded from the persistent store (=fetched). So all newly inserted objects are not observed.

this might be one reason for not getting triggered for rows 2/3 if they were not fetched but created. Otherwise I have no idea why it doesn't work yet-

Volker


Am 07.10.2009 um 18:54 schrieb Joshua Garnham:

Hi,
>
>Ok, I have changed it to awakeFromInsert: and have removed the observer in the NSManagedObjects dealloc: method.
>And have already fixed the performSelector: problem.
>
>So the NSManagedObject sub-class looks like …
>
>- (void) awakeFromFetch {
>    [self addObserver:[NSApp delegate] forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil];
>}
>
>- (void)dealloc {
>    [self removeObserver:[NSApp delegate] forKeyPath:@"name"];
>    [super dealloc];
>}
>
>
>… and the App Delegate …
>
>- (void)observeValueForKeyPath:(NSString *)keyPath
>                                  ofObject:(id)object
>                                    change:(NSDictionary *)change
>                                    context:(void *)context {
>    [self performSelector:@selector(doSomthing:)];
>}
>
>It builds without any warnings but it only half works.
>What happens is as follows …
>In my table view I have added three rows, each have text fields bound to the 'name' property.
>The method is triggere when I change the text for the first row however it is not triggered when I change the text for the
>other rows. Do you have any idea why this is?



_______________________________________________

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

References: 
 >Triggering a Method when a Core Data Property is Altered. (From: Joshua Garnham <email@hidden>)
 >Re: Triggering a Method when a Core Data Property is Altered. (From: Volker in Lists <email@hidden>)
 >Re: Triggering a Method when a Core Data Property is Altered. (From: Volker in Lists <email@hidden>)
 >Re: Triggering a Method when a Core Data Property is Altered. (From: Volker in Lists <email@hidden>)
 >Re: Triggering a Method when a Core Data Property is Altered. (From: Volker in Lists <email@hidden>)

  • Prev by Date: Re: Constructive Criticism
  • Next by Date: Re: [iPhone] Application running for the very first time...
  • Previous by thread: Re: Triggering a Method when a Core Data Property is Altered.
  • Next by thread: Re: Triggering a Method when a Core Data Property is Altered.
  • Index(es):
    • Date
    • Thread