NSInvalidArgumentException on -[UICollectionView insertItemsAtIndexPaths:]

Number:rdar://13133715 Date Originated:01-Feb-2013 06:08 PM
Status:open Resolved:
Product:iPhone SDK Product Version:6.0/6.1
Classification:crash/hang/data loss Reproducible:always
If a first responder view for a UICollectionViewCell is showing when either [UICollectionView insertItemsAtIndexPaths:] or [UICollectionView deleteItemsAtIndexPaths:] are called then application will crash with a NSInvalidArgumentException with following reason:
-[UICollectionViewUpdateItem action]: unrecognized selector sent to instance
In contrast calling [UICollectionView reloadData] avoids this error and dismisses the first responder before
updating without crashing although this is not an adequate solution.

Steps to Reproduce:
Create a UICollectionViewController with a cell containing a UITextField (or other object with an input view) and a control to trigger an item insert/delete.
Begin editing the text field and then trigger the insert/delete.

Sample project at https://github.com/gwithian/UICollectionViewBugExample

Expected Results:
UICollectionView should complete the insert/delete animation without crashing.



The following warning is logged to the console when textfield begins editing:
"setting the first responder view of the collection view but we don't know its type (cell/header/footer)"
I am as yet unable to find a way to remove these warnings but imagine it is related to the above issue

Console output for crash:
"2013-02-01 18:00:52.520 UICollectionViewBugExample[1464:907] -[UICollectionViewUpdateItem action]: unrecognized selector sent to instance 0x1ed5cf00
2013-02-01 18:00:52.530 UICollectionViewBugExample[1464:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICollectionViewUpdateItem action]: unrecognized selector sent to instance 0x1ed5cf00'
*** First throw call stack:
(0x337c02a3 0x3ab4d97f 0x337c3e07 0x337c2531 0x33719f68 0x33dbfbc3 0x33dbe295 0x94697 0x33a8c0a5 0x33a8c12d 0x33a8c0a5 0x33a8c057 0x33a8c035 0x33a8b8eb 0x33a8bde1 0x339b45f1 0x339a1801 0x339a111b 0x387245a3 0x387241d3 0x33795173 0x33795117 0x33793f99 0x33706ebd 0x33706d49 0x387232eb 0x339f52f9 0x941fd 0x39e84b20)
libc++abi.dylib: terminate called throwing an exception"


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!