ios - Debugging Core Data __NSCFSet addObject nil exception -


i'm getting exceptions thrown during unit tests, on core data thread message:

coredata: error: serious application error. exception caught during core data change processing. bug within observer of nsmanagedobjectcontextobjectsdidchangenotification. -[__nscfset addobject:]: attempt insert nil userinfo (null)

*** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfset addobject:]: attempt insert nil' *** first throw call stack: (     0   corefoundation                      0x00683a14 __exceptionpreprocess + 180     1   libobjc.a.dylib                     0x02334e02 objc_exception_throw + 50     2   corefoundation                      0x0068393d +[nsexception raise:format:] + 141     3   corefoundation                      0x005595b9 -[__nscfset addobject:] + 185     4   coredata                            0x001d47c0 -[nsmanagedobjectcontext(_nsinternalchangeprocessing) _processpendinginsertions:withdeletions:withupdates:] + 560     5   coredata                            0x001cee8a -[nsmanagedobjectcontext(_nsinternalchangeprocessing) _processrecentchanges:] + 2410     6   coredata                            0x001ce506 -[nsmanagedobjectcontext processpendingchanges] + 54     7   coredata                            0x001f359b developersubmittedblocktonsmanagedobjectcontextperform + 443 

i'm trying determine what's causing it, since it's occurring on nsmanagedobjectcontext queue, thread has no stack trace of own code.

i set symbolic breakpoints on -[__nscfset addobject:] , -[nsmanagedobjectcontext processpendingchanges], wasn't able see state while stopped there, helping me determine objects causing issues.

the next step occurred me try swizzling -[__nscfset addobject:] add own implementation, stop when argument nil. set isn't empty, , more information seeing contents before inserting nil. ran difficulties swizzling it, though, since it's private class.

using approach above, or 1 hadn't considered, how can more information on what's causing exception?

thanks @bteapot suggesting add -com.apple.coredata.concurrencydebug 1 argument scheme. got more information on how works ole begemann's excellent core data concurrency debugging article.

adding flag causes exception thrown code calls nsmanagedobjectcontext incorrect thread. works great in xcode, advised in xcode bot, causes tests fail unhelpful message:

lost connection test manager service


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -