• 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
[Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?


  • Subject: [Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
  • From: Aurélien Hugelé <email@hidden>
  • Date: Fri, 22 May 2009 09:00:00 +0200


Hi list!

In the documentation it is clearly stated that we should not trigger change notifications in the *didSave* method of NSmanagedObject.
The willSave method is not very well described. In particular, can we use setValue:forKey: (or trigger change notifications) inside it?


I usually do something like :

-(void)willSave
{
	if([self isDeleted])
	{
		// cleanup some other object state
		// or use [self setValue:Y forKey:X] here
	}
}

And as a result I often get  a "strange" exception :

Failed to process pending changes before save. The context is still dirty after 100 attempts. Typically this recursive dirtying is caused by a bad validation method, -willSave, or notification handler."

it seems that for *deleted* objects only, triggering change notifications is now allowed.
Am I right ?




Aurélien,
Objective Decision Team





_______________________________________________

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: [Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: Re: Getting other application's window/document name
  • Next by Date: Re: Compiler does not synthesize KVO compliant properties for CATiledLayer subclass (was: Synthesized properties for scalars not KVO compliant)
  • Previous by thread: RE: How to use CFReadStrem and abort read stream normally?
  • Next by thread: Re: [Core Data] Can we use setValue:forKey: in *willSave* method of NSManagedObject?
  • Index(es):
    • Date
    • Thread