• 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: Saving Issue with Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving Issue with Core Data


  • Subject: Re: Saving Issue with Core Data
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 19 Apr 2006 22:07:06 -0700


On Apr 19, 2006, at 9:44 PM, Mathieu Tozer wrote:

I've got an issue where I can add and delete objects in my small application but when I quit and re-run the new objects haven't been saved. They previously did, however, as the application is essentially just a modified Core Data prototype with a single entity. The only thing I have modified is to add a controller object for some buttons which do a few computations, and then update the selected object like this:

NSArray *selectedObjectsArray = [activityTableController selectedObjects];
NSManagedObject *selectedActivity = [selectedObjectsArray objectAtIndex:0];
previousTime = [selectedActivity valueForKey:@"timeSpent"];
NSNumber *totalTime;
totalTime = [NSNumber numberWithInt:[previousTime intValue] + seconds];
[selectedObjectsArray setValue:totalTime forKey:@"timeSpent"];


Could this code be affecting the managedObjectContext to save?

This code doesn't save the context:
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ Articles/cdUsingMOs.html#//apple_ref/doc/uid/TP40001803-212651>


What do you do to save the document?
In the default single-window template, the save is implemented by an application delegate method:


- (NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *)sender

Have you reset the application's delegate?


There is also an IBOutlet to the activityTableController to obtain the currently selected items declared in the controller header:
IBOutlet NSArrayController *activityTableController;


Is the outlet nil?

mmalc


_______________________________________________ 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
References: 
 >Saving Issue with Core Data (From: Mathieu Tozer <email@hidden>)

  • Prev by Date: Re: Any tricks to dragging an NSTableView?
  • Next by Date: Re: Core Data SIGSEGV when opening an existing document
  • Previous by thread: Saving Issue with Core Data
  • Next by thread: Discovering where a method was called from within the method
  • Index(es):
    • Date
    • Thread