Skip navigation.
 
mlCore Data: attempt to insert nil key exception on save:
FROM : Paul Collins
DATE : Tue Jun 20 21:47:08 2006

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. With 
backtrace:

#0  0x92991008 in -[NSException raise] ()
#1  0x92990e5c in +[NSException raise:format:] ()
#2  0x92957468 in -[NSCFDictionary setObject:forKey:] ()
#3  0x94103334 in -[NSXMLDocumentMap 
nodeFromManagedObject:objectIDMap:] ()
#4  0x941025dc in -[NSXMLDocumentMap addObject:objectIDMap:] ()
#5  0x94102070 in -[NSMappedObjectStore 
executeSaveChangesRequest:withContext:] ()
#6  0x940e26f8 in -[NSPersistentStoreCoordinator(_NSInternalMethods) 
executeRequest:withContext:] ()
#7  0x940f5b68 in -[NSManagedObjectContext save:] ()
#8  0x00004f28 in -[GSApp applicationShouldTerminate:] 
(self=0x3868c0, _cmd=0x90a8c68c, sender=0x31c7d0) at /Users/paul/Gray/
Projects/Digittach/dev/Digittach/GSApp.m:390
#9  0x937c3ab8 in -[NSApplication _docController:shouldTerminate:] ()
#10 0x937c34c0 in -[NSApplication _shouldTerminate] ()

To isolate the problem, I changed FileServer's class to just an empty 
subclass of Server's class. I can insert a "Server" and save ok, but 
not a "FileServer", which should be the same thing, shouldn't it?

I tried building a separate bare bones Core Data app with just the 
entities and empty classes, but can't replicate it there, so there's 
something I'm doing in the real app.

I can't see anything unusual about the "FileServer" object from it's 
description. Anybody have a suggestion?

Thanks,

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/          **

Related mailsAuthorDate
mlCore Data: attempt to insert nil key exception on save: Paul Collins Jun 20, 21:47
mlRe: Core Data: attempt to insert nil key exception on save: Paul Collins Jun 22, 06:57
ml[SOLVED] Re: Core Data: attempt to insert nil key exception on save: Paul Collins Jun 23, 19:23