• 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
CoreData: Using willSave to update timestamps causes hang?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData: Using willSave to update timestamps causes hang?


  • Subject: CoreData: Using willSave to update timestamps causes hang?
  • From: Jim Correia <email@hidden>
  • Date: Mon, 2 May 2005 11:37:07 -0400

The NSManagedObject documentation says:

<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSManagedObject.html#//apple_ref/doc/uid/ TP30001171-BBCGBABB>

    willSave
    - (void)willSave

Invoked automatically by the Core Data framework when the receiver’s
managed object context is saved. It is commonly used to compute
persisted values from other transient values, to set timestamps, and so
on. This method can have “side effects” on the persistent values.


When I use this to do that exactly - modify the last saved timestamp of an object, I get a hang when saving. It appears that making the change inside of willSave causes willSave to be called again.

- (void)willSave
{
    [self setValue: [NSDate date] forKey: @"lastSavedDate"];
}

Sample project and full sample available at:

<http://homepage.mac.com/jimcorreia/tmp/WillSave.zip>

Am I doing something obviously wrong? Is this a bug (in which case I'll write a radar.) Any workarounds?

Thanks,
Jim


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: CoreData: Using willSave to update timestamps causes hang?
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Tiger gcc 4 builds apps that don't run on 10.2.8
  • Next by Date: Re: Tiger documentation update
  • Previous by thread: Re: Date / time localisation
  • Next by thread: Re: CoreData: Using willSave to update timestamps causes hang?
  • Index(es):
    • Date
    • Thread