• 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: Core Data troubles - not removing objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data troubles - not removing objects


  • Subject: Re: Core Data troubles - not removing objects
  • From: Adam Swift <email@hidden>
  • Date: Thu, 1 Nov 2007 15:40:42 -0700


On Nov 1, 2007, at 2:04 AM, Benjámin Salánki wrote:

Hi all,

I am pretty lost in the development of my app which uses Core Data and an SQLiteStore. I hope someone can point me towards the obvious point I am missing.

Given are two entities with bidirectional 1-to-1 relationships set to cascade upon deletion. The first entity contains strings and the other one contains binary data (like images and stuff). I set up two NSArrayControllers in IB and made the second one contain a set of the selected item from the first and also set the Deletes objects on remove checkbox in the Inspector.

My problem is that if I send the remove: or removeObject: message to the first NSArrayController and then query said item if it is isDeleted, I get true for the item itself, but false for the item connected through the relationship. I then manually removed the second object by sending a removeObject: message to it. Calling isDeleted now returns true.

The cascade delete rule isn't processed until you save the managed object context in which you made the change, you can force the delete rule processing by calling processPendingChanges. I believe this is mentioned in the release notes here: http://developer.apple.com/releasenotes/Cocoa/CoreDataReleaseNotes/index.html

All is nice except the SQLiteStore file does not get reduced in size. I guess that somehow I am doing something wrong and the objects do not get removed form the object graph at the next save: operation.

The sqlite database file format won't grow and shrink in response to every change you make, for performance reasons data is mapped to pages which may contain many individual data records (or a single data record can span many pages).

Is there anything obviously wrong or missing from my way of handling this? I could post some code if required.

Thanks,
ben
_______________________________________________

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

_______________________________________________

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 troubles - not removing objects
      • From: Benjámin Salánki <email@hidden>
References: 
 >Core Data troubles - not removing objects (From: Benjámin Salánki <email@hidden>)

  • Prev by Date: [Leopard] Core Data migration does not find legacy model
  • Next by Date: Re: Core Data troubles - not removing objects
  • Previous by thread: Core Data troubles - not removing objects
  • Next by thread: Re: Core Data troubles - not removing objects
  • Index(es):
    • Date
    • Thread