• 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: attempt to insert nil key exception on save:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: attempt to insert nil key exception on save:


  • Subject: Re: Core Data: attempt to insert nil key exception on save:
  • From: Paul Collins <email@hidden>
  • Date: Wed, 21 Jun 2006 21:57:58 -0700

On Jun 20, 2006, at 12:47 PM, Paul Collins wrote:
I have a model which includes an entity "Server" with sub-entities "iDisk" and "FileServer". Each has a custom class, and the latter two's classes are subclasses of Server's class. "iDisk" works fine, but when I insert a "FileServer" and then save, I get exception: - [NSCFDictionary setObject:forKey:]: attempt to insert nil key.


On further investigation, I find that sub-entities are not the problem. In my particular app, I cannot create (instantiate) a core data object that has a relationship property, other than the 5 existing Entities in my model that do. That is, I can create instances of various Entities from my model, but adding a new Entity to the model and then instantiating it, causes the error on save, but only if it includes a relationship property. (I'm deleting the xml store file before each launch).

I've tried various ways of defining and/or initializing the relationship property, but Core Data just won't let me add a new Entity and save it, if it has a relationship. I'm not using sub- entities or even subclasses, just plain Entities with NSManagedObject. There are no validation errors, just the NSException (and an empty xml store file).

Do you think my .xcdatamodel file is corrupted? My next idea is to recreate it from scratch. If that doesn't work, I may have to reconsider Core Data entirely.

--Paul Collins


** Gracion Software LLC http://www.gracion.com/ ** ** Tel: +1 (541) 488-3488 iChat/AV/AIM: gracionsoft ** ** DigiTunnel 1.4 PPTP/VPN client for OS X ** ** Pronto Patent - search/download US patents fast ** ** And check out: http://www.opendoor.com/doorstop/ **


_______________________________________________ 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:
    • [SOLVED] Re: Core Data: attempt to insert nil key exception on save:
      • From: Paul Collins <email@hidden>
References: 
 >Core Data: attempt to insert nil key exception on save: (From: Paul Collins <email@hidden>)

  • Prev by Date: [Q] setAllowedFileTypes: of NSOpenPanel
  • Next by Date: <NSInternalConsistencyException> Error (1002) creating CGSWindow
  • Previous by thread: Core Data: attempt to insert nil key exception on save:
  • Next by thread: [SOLVED] Re: Core Data: attempt to insert nil key exception on save:
  • Index(es):
    • Date
    • Thread