Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView internal consistency crash

I'm struggling with this intermittent crash issue on my UITableView which has UICollectionViews.

I have a navigation controller whose root view controller has:

  1. UITableView with 3 sections
  2. Each section has one row
  3. Each row has a UICollectionView
  4. The top row of UITableView (which is a collection view) is made to scroll automatically based on NSTimer.

The crash occurs when I push into the navigation controller and pop out back and forth. It happens when I do pushing and popping 3-4 times

The trace:

Thread 0 Crashed:
0   libobjc.A.dylib                 0x38f74626 objc_msgSend + 6
1   UIKit                           0x312a6740 -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 60
2   UIKit                           0x31020798 -[UIScrollView setContentOffset:] + 600
3   UIKit                           0x312a76b6 -[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary] + 1394
4   UIKit                           0x310d33d2 -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 414
5   UIKit                           0x310d322a -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:] + 26
6   UIKit                           0x310d31e2 -[UIScrollView removeFromSuperview] + 26
7   UIKit                           0x31001952 -[UIView dealloc] + 374
8   CoreFoundation                  0x2e700140 CFRelease + 556
9   CoreFoundation                  0x2e70b668 -[__NSArrayM dealloc] + 156
10  libobjc.A.dylib                 0x38f79b66 objc_object::sidetable_release(bool) + 170
11  libobjc.A.dylib                 0x38f7a0ce (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 354
12  CoreFoundation                  0x2e70347c _CFAutoreleasePoolPop + 12
13  CoreFoundation                  0x2e798f0e __CFRunLoopRun + 1310
14  CoreFoundation                  0x2e703724 CFRunLoopRunSpecific + 520
15  CoreFoundation                  0x2e703506 CFRunLoopRunInMode + 102
16  GraphicsServices                0x336726ce GSEventRunModal + 134
17  UIKit                           0x3106486c UIApplicationMain + 1132
18  BoatSenzeDev                    0x00110648 main (main.m:16)
19  libdyld.dylib                   0x39468ab4 start + 0
like image 396
Ikruu Avatar asked Sep 29 '14 15:09

Ikruu


1 Answers

I think there's a bug somewhere on iOS 8 regarding the timing of UITableViewController (or plain UIViewController containing a UITableView) dealloc when dealing with transition animations. Somehow the view controller is already deallocated, but the table view is still trying to send messages to its delegate.

As a workaround, you can implement the dealloc method on the UITableViewController like this:

- (void)dealloc
{
    self.tableView.delegate = nil;
    self.tableView.dataSource = nil;
}
like image 116
Ricardo Sanchez-Saez Avatar answered Nov 06 '22 10:11

Ricardo Sanchez-Saez