iosuicollectionviewcrash

UIFlowLayoutRow watchdog termination crash on iOS


My app metrics shows that some devices crash with the following information:

Exception Type:  EXC_CRASH (SIGKILL)
Process Visibility: Foreground
Watchdog Event: scene-update (other reports has scene-create)
Watchdog Visibility: Background
Termination Code: 0x8badf00d

Stack traces:

UIKitCore  -[_UIFlowLayoutRow layoutRow]
UIKitCore  -[_UIFlowLayoutRow layoutRow]
UIKitCore  -[_UIFlowLayoutSection computeLayoutInRect:forSection:invalidating:invalidationContext:]
UIKitCore  __76-[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]_block_invoke
CoreFoundation  __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
CoreFoundation  -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
UIKitCore  -[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]
UIKitCore  -[UICollectionViewFlowLayout _fetchItemsInfoForRect:]
UIKitCore  -[UICollectionViewFlowLayout prepareLayout]
UIKitCore  -[UICollectionViewData _prepareToLoadData]
UIKitCore  -[UICollectionViewData validateLayoutInRect:]
UIKitCore  -[UICollectionViewData layoutAttributesForElementsInRect:]
UIKitCore  -[UICollectionView _indexPathForItemAtPoint:]
UIKitCore  -[UICollectionView indexPathForItemAtPoint:]
MyApp  - [MyAppCollectionViewController gestureRecognizer:shouldReceiveTouch:]
UIKitCore  -[UIGestureRecognizer _delegateShouldReceiveTouch:forEvent:]
UIKitCore  -[UIGestureRecognizer _internalShouldReceiveTouch:forEvent:recognizerView:]
UIKitCore  __80-[UITouchesEvent _addGestureRecognizersForGestureOwner:toTouch:forContinuation:]_block_invoke
UIKitCore  __70-[UITouchesEvent _collectGestureRecognizersForGestureOwner:withBlock:]_block_invoke
UIKitCore  -[UITouchesEvent _collectGestureRecognizersForGestureOwner:withBlock:]
UIKitCore  -[UITouchesEvent _addGestureRecognizersForGestureOwner:toTouch:forContinuation:]
UIKitCore  -[UITouchesEvent _addTouch:forDelayedDelivery:]
UIKitCore  _AddTouchToEventAndDetermineIfNeedsCancel
UIKitCore  ____updateTouchesWithDigitizerEventAndDetermineIfShouldSend_block_invoke.51
CoreFoundation  __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
CoreFoundation  ____NSDictionaryEnumerate_block_invoke_2
CoreFoundation  CFBasicHashApply
CoreFoundation  __NSDictionaryEnumerate
UIKitCore  __dispatchPreprocessedEventFromEventQueue
UIKitCore  __processEventQueue
UIKitCore  __eventFetcherSourceCallback
CoreFoundation  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
CoreFoundation  __CFRunLoopDoSource0
CoreFoundation  __CFRunLoopDoSources0
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
GraphicsServices  GSEventRunModal
UIKitCore  -[UIApplication _run]
UIKitCore  UIApplicationMain

Thread ID: 0
Stacktrace:
libsystem_kernel.dylib  poll
MyApp  pollset_work(grpc_pollset*, grpc_pollset_worker**, grpc_core::Timestamp)
MyApp  cq_next(grpc_completion_queue*, gpr_timespec, void*)
MyApp  __27-[GRPCCompletionQueue init]_block_invoke_2
libdispatch.dylib  _dispatch_call_block_and_release
libdispatch.dylib  _dispatch_client_callout
libdispatch.dylib  _dispatch_root_queue_drain
libdispatch.dylib  _dispatch_worker_thread2
libsystem_pthread.dylib  _pthread_wqthread
libsystem_pthread.dylib  start_wqthread

Thread ID: 1
Stacktrace:
libsystem_pthread.dylib  start_wqthread

Thread ID: 2
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
CoreFoundation  __CFRunLoopServiceMachPort
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
Foundation  -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
Foundation  -[NSRunLoop(NSRunLoop) runUntilDate:]
UIKitCore  -[UIEventFetcher threadMain]
Foundation  __NSThread__start__
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 3
Stacktrace:
libsystem_pthread.dylib  start_wqthread

Thread ID: 4
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
MyApp  crashpad::MachMessageWithDeadline(mach_msg_header_t*, int, unsigned int, unsigned int, unsigned long long, unsigned int, bool)
MyApp  crashpad::MachMessageServer::Run()
MyApp  crashpad::(anonymous namespace)::CrashHandler::ThreadMain()
MyApp  crashpad::Thread::ThreadEntryThunk(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 5
Stacktrace:
libsystem_pthread.dylib  start_wqthread

Thread ID: 6
Stacktrace:
libsystem_kernel.dylib  semaphore_timedwait_trap
libdispatch.dylib  _dispatch_sema4_timedwait
libdispatch.dylib  _dispatch_semaphore_wait_slow
MyApp  crashpad::Semaphore::TimedWait(double)
MyApp  crashpad::internal::WorkerThreadImpl::ThreadMain()
MyApp  crashpad::Thread::ThreadEntryThunk(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 7
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
CoreFoundation  __CFRunLoopServiceMachPort
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
CFNetwork  _CFURLStorageSessionDisableCache
Foundation  __NSThread__start__
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 8
Stacktrace:
libsystem_kernel.dylib  semaphore_timedwait_trap
libdispatch.dylib  _dispatch_sema4_timedwait
libdispatch.dylib  _dispatch_semaphore_wait_slow
MyApp  crashpad::Semaphore::TimedWait(double)
MyApp  crashpad::internal::WorkerThreadImpl::ThreadMain()
MyApp  crashpad::Thread::ThreadEntryThunk(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 9
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  gpr_cv_wait
MyApp  grpc_core::Executor::ThreadMain(void*)
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 10
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  gpr_cv_wait
MyApp  grpc_core::Executor::ThreadMain(void*)
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 11
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  gpr_cv_wait
MyApp  timer_thread(void*)
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 12
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 13
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 14
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 15
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 16
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 17
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  grpc_event_engine::experimental::OriginalThreadPool::Queue::Step()
MyApp  grpc_event_engine::experimental::OriginalThreadPool::StartThread()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 18
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::TimedWait(absl::synchronization_internal::KernelTimeout)
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  absl::CondVar::WaitWithTimeout(absl::Mutex*, absl::Duration)
MyApp  grpc_event_engine::experimental::TimerManager::WaitUntil(grpc_core::Timestamp)
MyApp  grpc_event_engine::experimental::TimerManager::MainLoop()
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 19
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
CoreFoundation  __CFRunLoopServiceMachPort
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
CoreFoundation  _legacyStreamRunLoop_workThread
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 20
Stacktrace:
libsystem_kernel.dylib  __select
CoreFoundation  __CFSocketManager
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 21
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
CoreFoundation  __CFRunLoopServiceMachPort
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
CFNetwork  _CFURLStorageSessionDisableCache
Foundation  __NSThread__start__
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 22
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
CoreFoundation  __CFRunLoopServiceMachPort
CoreFoundation  __CFRunLoopRun
CoreFoundation  CFRunLoopRunSpecific
Foundation  -[NSRunLoop(NSRunLoop) runMode:beforeDate:]
MyAppWebView  base::MessagePumpNSRunLoop::DoRun(base::MessagePump::Delegate*)
MyAppWebView  base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*)
MyAppWebView  base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta)
MyAppWebView  base::RunLoop::Run(base::Location const&)
MyAppWebView  base::Thread::Run(base::RunLoop*)
MyAppWebView  base::Thread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 23
Stacktrace:
libsystem_kernel.dylib  kevent64
MyAppWebView  base::MessagePumpKqueue::DoInternalWork(base::MessagePump::Delegate*, base::MessagePump::Delegate::NextWorkInfo*)
MyAppWebView  base::MessagePumpKqueue::Run(base::MessagePump::Delegate*)
MyAppWebView  base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta)
MyAppWebView  base::RunLoop::Run(base::Location const&)
MyAppWebView  base::Thread::Run(base::RunLoop*)
MyAppWebView  base::internal::ServiceThread::Run(base::RunLoop*)
MyAppWebView  base::Thread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 24
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
MyAppWebView  base::WaitableEvent::TimedWaitImpl(base::TimeDelta)
MyAppWebView  base::WaitableEvent::TimedWait(base::TimeDelta)
MyAppWebView  base::internal::WorkerThread::Delegate::WaitForWork(base::WaitableEvent*)
MyAppWebView  base::internal::WorkerThread::RunWorker()(
MyAppWebView  base::internal::WorkerThread::RunPooledWorker()
MyAppWebView  base::internal::WorkerThread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 25
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
MyAppWebView  base::WaitableEvent::TimedWaitImpl(base::TimeDelta)
MyAppWebView  base::WaitableEvent::TimedWait(base::TimeDelta)
MyAppWebView  base::internal::WorkerThread::Delegate::WaitForWork(base::WaitableEvent*)
MyAppWebView  base::internal::WorkerThread::RunWorker()
MyAppWebView  base::internal::WorkerThread::RunBackgroundPooledWorker()
MyAppWebView  base::internal::WorkerThread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 26
Stacktrace:
libsystem_kernel.dylib  kevent64
MyAppWebView  base::MessagePumpKqueue::DoInternalWork(base::MessagePump::Delegate*, base::MessagePump::Delegate::NextWorkInfo*)
MyAppWebView  base::MessagePumpKqueue::Run(base::MessagePump::Delegate*)
MyAppWebView  base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta)
MyAppWebView  base::RunLoop::Run(base::Location const&)
MyAppWebView  base::Thread::Run(base::RunLoop*)
MyAppWebView  web::WebSubThread::IOThreadRun(base::RunLoop*)
MyAppWebView  base::Thread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 27
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
MyAppWebView  base::WaitableEvent::TimedWaitImpl(base::TimeDelta)
MyAppWebView  base::WaitableEvent::TimedWait(base::TimeDelta)
MyAppWebView  base::internal::WorkerThread::Delegate::WaitForWork(base::WaitableEvent*)
MyAppWebView  base::internal::WorkerThread::RunWorker()
MyAppWebView  base::internal::WorkerThread::RunPooledWorker()
MyAppWebView  base::internal::WorkerThread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 28
Stacktrace:
libsystem_kernel.dylib  mach_msg2_trap
libsystem_kernel.dylib  mach_msg2_internal
libsystem_kernel.dylib  mach_msg_overwrite
libsystem_kernel.dylib  mach_msg
MyAppWebView  base::WaitableEvent::TimedWaitImpl(base::TimeDelta)
MyAppWebView  base::WaitableEvent::TimedWait(base::TimeDelta)
MyAppWebView  base::internal::WorkerThread::Delegate::WaitForWork
MyAppWebView  base::internal::WorkerThread::RunWorker()
MyAppWebView  base::internal::WorkerThread::RunBackgroundPooledWorker()
MyAppWebView  base::internal::WorkerThread::ThreadMain()
MyAppWebView  base::(anonymous namespace)::ThreadFunc(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

Thread ID: 29
Stacktrace:
libsystem_kernel.dylib  __psynch_cvwait
libsystem_pthread.dylib  _pthread_cond_wait
MyApp  absl::synchronization_internal::PthreadWaiter::TimedWait(absl::synchronization_internal::KernelTimeout)
MyApp  absl::synchronization_internal::PthreadWaiter::Wait(absl::synchronization_internal::KernelTimeout)
MyApp  AbslInternalPerThreadSemWait
MyApp  absl::CondVar::WaitCommon(absl::Mutex*, absl::synchronization_internal::KernelTimeout)
MyApp  absl::CondVar::WaitWithTimeout(absl::Mutex*, absl::Duration)
MyApp  gpr_cv_wait
MyApp  timer_thread(void*)
MyApp  Thread::ThreadBody(void*)
libsystem_pthread.dylib  _pthread_start
libsystem_pthread.dylib  thread_start

There is a similar unanswered question on Apple Developer forum. I checked Apple Watchdog termination documentation but it didn't help much.

I tried to reproduce it on my iPhone or simulator but I couldn't. Did anyone have the same issue before and how did you fix it?


Solution

  • The bug is related to the layout configuration:

    1. I implemented a custom UICollectionViewFlowLayout where estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize

    2. Each cell implemented its own preferredLayoutAttributesFittingAttributes.

    3. I implemented a custom UICollectionViewController. It implemented UICollectionViewDelegate and returned NO for @selector(collectionView:layout:sizeForItemAtIndexPath:) so that the UICollectionView uses automatic cell sizing, except for a special cell where I wanted the UICollectionView to use manual sizing by calling UICollectionViewDelegate's sizeForItemAtIndexPath.

    My guess is that the new logic which returned YES in @selector(collectionView:layout:sizeForItemAtIndexPath:) for the special cell somehow affected some other cells and caused the crash. I fixed it by getting rid of the manual cell sizing logic. Now, UICollectionViewDelegate returns NO in @selector(collectionView:layout:sizeForItemAtIndexPath:) for all cells and automatic cell sizing is used for all cells.