简体   繁体   中英

App crashes when Back button tapped while scrolling table view

I present a modal table view within a navigation view with a Back button. The back button sends a message to the modal view's delegate to dismiss the modal view. If I scroll the table view and then tap the Back button on the navigation bar while the table view is still scrolling, the app crashes with this message:

*** -[UILayoutContainerView setUseFastMode:]: message sent to deallocated instance 0xef74650

When I PO 0xef74650 I get this:

(int) $1 = 251086416 [no Objective-C description available]

Anyone experience this before? What is the workaround or fix?

I believe this is a bug in iOS 5.1 that occurs when animating the dismissing of a modal that is currently scrolling. I was getting reports from users that my app was crashing, and when I investigated I had the same error.

I created a new project with the minimal amount of code/views and was able to reproduce this crash. The only workaround I've found so far is to disable animation when dismissing a modal. I've submitted a bug report to Apple.

I had a similar issue, my app was crashing if the table was still scrolling and I triggered a modal view to appear over the table. The crash in my instance was thrown in cellForRowAtIndexPath , indexPath had been deallocated.

I fixed it by stopping scrolling in the viewWillDisappear method:-

- (void) viewWillDisappear:(BOOL)animated {
    [self.tableView setContentOffset:self.tableView.contentOffset animated:NO];
}

Hopefully this might help someone researching related problems!

iOS 5 has a bug in the FastModeAdditions category on UIView. This bug manifests if you have a subview of the scroll view that is being scrolled in the same run loop as the modal view controller is being dismissed.

    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xa0000008
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x34bdef78 objc_msgSend + 16
1   UIKit                           0x35309f9e -[UIView(FastModeAdditions) _setContainerLayoutViewForFastMode:] + 98
2   UIKit                           0x351701cc -[UIView dealloc] + 568
3   UIKit                           0x3545a39e -[UIDropShadowView dealloc] + 86
4   libobjc.A.dylib                 0x34be016e _objc_rootRelease + 30
5   CoreFoundation                  0x32b882e0 CFRelease + 88

The best work around we found is to performSelector:afterDelay: the dismissal. This forces the dismissal on a later run loop and the crash no longer occurs.

This does not occur on iOS 6.

检入setUseFastMode:确保您没有发布以后尝试访问的内容。

[someObject release];

I was dismissing a modal when tapping a button inside the modal and getting this crash if its table was still scrolling. This was incorrect: after moving the dismiss code to the presenting view controller, and calling it as part of a delegate method, the crash no longer occurs.

This worked for me:

NSIndexPath *myIP = [NSIndexPath indexPathForRow:0 inSection:0]
[self.tblChildProducts scrollToRowAtIndexPath:myIP atScrollPosition:UITableViewScrollPositionTop animated:NO]
[self dismissModalViewControllerAnimated:YES]

@Slee May 24 '12 at 11:18

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM