I have an iPhone SDK application that has several views that appear and disappear as the user creates content. After using the application on a device for a while, I get th
I just worked through this problem myself.
I had an issue where:
The problem was the scrollview delegate messages were firing on a new-deallocated object, and the crash logs were a bit confusing as they were pointing to nonsensical object references.
The fix was to set the scrollview delegate to nil as the first line of my view controller dealloc method.
Hope this helps someone else!
This may happen if you inserted a refresh controller into a table view as a subview (my hint, never do that)...
For completeness I'm adding this stack trace (iOS 6) for those who may encounter the same problem but with a little bit different implementation and the exact steps to reproduce the problem.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x71f05631
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3919b5d0 objc_msgSend + 1
1 UIKit 0x33421830 -[UIScrollView(UIScrollViewInternal) _delegateScrollViewAnimationEnded] + 48
2 UIKit 0x334217ba -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 130
3 UIKit 0x334216a4 -[UIAnimator stopAnimation:] + 460
This is happening on iOS 6 and started to occur when I implemented the UIScrollViewDelegate method:
" -(void)scrollViewDidEndDecelerating:(UITableView *)tableView"
and made a call to:
"[tableView scrollToRowAtIndexPath: indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];".
The problem occurred when the animation started and I pressed the "Back" button and my view controller was popped off before the animation completed.
When reproducing you must be sure to press the "Back" button after the the animation starts but before it completes. It took my a few tries. I tried to recreate the problem by programmatically popping the view controller off but was not able to reproduce it. I had to use the "Back" button. I had been simply calling [myTableView release] in the dealloc. The solution was as described here to set both of these properties to nil:
self.myTableView.delegate = nil;
self.myTableView = nil;