• 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
Getting NSException on NSManagedObjectContext save:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting NSException on NSManagedObjectContext save:


  • Subject: Getting NSException on NSManagedObjectContext save:
  • From: Neil Clayton <email@hidden>
  • Date: Sun, 18 Mar 2007 09:57:40 +1200

Hi,

I've recently been updating some previously working CoreData objects / models, and I'm running into a problem with the save method.
I'm doing the following:


    if (managedObjectContext != nil) {
        if ([managedObjectContext commitEditing]) {
			BOOL hasChanges = [managedObjectContext hasChanges];
			BOOL savedOK = YES;
			@try {
				savedOK = [managedObjectContext save:&error];
			} @catch(NSException *ex) {
				[self log:@"Failed to save iShowU settings. %@, %@", ex, error];
				savedOK = NO;
			}

I've intentionally left out the remainder of the code, for brevity.
The update to the model has included making two properties double, where previously they were int's, and changing the binding from a slider to a drop down. I've put logging code into the object model itself, and I'm able to verify that the two modified properties are in fact getting the correct double values.


I'm seeing an NSException on the save method.
I'm almost certain that I'm either putting an incorrect value into the model, or something - which would be simple enough to fix, if I actually knew what the real error was.


The NSException reads:

*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value

Yet the error class is still nil.
I managed to find the cause by dumping the object before saving it and manually staring at every value until I found the nil - is there some better way? Is there some option I can turn on (an ENV variable, for example) that would cause CoreData to spit out more meaningful errors?


---
Regards,
Neil Clayton



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Getting NSException on NSManagedObjectContext save:
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: Preventing default drawing of slider bar in custom NSSlider class
  • Next by Date: Re: Setting the Key window after sheet ends
  • Previous by thread: Re: Preventing default drawing of slider bar in custom NSSlider class
  • Next by thread: Re: Getting NSException on NSManagedObjectContext save:
  • Index(es):
    • Date
    • Thread