ios - Core Data and UICollectionView. "Invalid update: invalid number of items in section 0" -


(please, review whole source code at: https://github.com/flostik2008/lnch)

main vc contains uicollectionview populated coredata, , "add" button create/add coredata entities.
when pressed, new vc slides in, creates new object within current nsmanagedobjectcontext. on view, user sets type of entity, , assigned 1 of entities attributes. upon choosing, new segue performed leads 3rd vc more detailed entity creation process.

after pressing button on 2nd vc, xcode shows errors:

1. assertion failure in -[uicollectionview _enditemanimationswithinvalidationcontext:tentativelyforreordering:animator:]... 2. error: serious application error.  exception caught during core data change processing.  bug within observer of nsmanagedobjectcontextobjectsdidchangenotification... 3. 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of items in section 0... 

by running series of breakpoints, able identify between 2nd vc , 3rd vc, create new coredata entity, instead of using same one, created creation of 2nd vc. , later, uicollectionview not being updated. did implemented delegate methods:

controllerwillchangecontent controllerdidchangecontent (with .performbatchupdates( {()-> void in...) ) controller( didchange anobject: ...) 

questions:

  1. how pass coredata entity between 2 vc, without creation new ones (so can preserve ux)
  2. how update uicollectionview , insert new objects without crash.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -