Unable to find reason for Crash on -[UIScrollView(

2019-03-15 03:13发布

问题:

In my app many crashes with the following log are reported very often, but even with several test devices and iOS versions I am not able to reproduce it. So there's no way to find the reason on Xcode. Because there's no step in the trace, that leads to my code, I cannot imagine any way to find the origin of it. The App itself is very complex and of course many Scroll Views, also embedded, are used.

Has anyone an idea where to start looking? Or has anyone had a similar problem before?

I'm very thankful for any help!

Best regards, Florian

OS Version:      iPhone OS 6.0.1 (10A523)
Report Version:  104

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0xd1d28fbc
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                     0x392e65b0 objc_msgSend + 16
1   UIKit                               0x35a839f7 -[UIScrollView(UIScrollViewInternal)  _scrollViewAnimationEnded:finished:] + 135
2   UIKit                               0x35a838e9 -[UIAnimator stopAnimation:] + 469
3   UIKit                               0x35b1e257 -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 295
4   UIKit                               0x35a83381 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 53
5   QuartzCore                          0x323d3071 CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 161
6   QuartzCore                          0x323d2fc9 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 65
7   IOMobileFramebuffer                 0x340befd7 IOMobileFramebufferVsyncNotifyFunc + 155
8   IOKit                               0x35ee8449 IODispatchCalloutFromCFMessage + 193
9   CoreFoundation                      0x339605db __CFMachPortPerform + 119
10  CoreFoundation                      0x3396b173 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
11  CoreFoundation                      0x3396b117 __CFRunLoopDoSource1 + 139
12  CoreFoundation                      0x33969f99 __CFRunLoopRun + 1385
13  CoreFoundation                      0x338dcebd CFRunLoopRunSpecific + 357
14  CoreFoundation                      0x338dcd49 CFRunLoopRunInMode + 105
15  GraphicsServices                    0x33f222eb GSEventRunModal + 75
16  UIKit                               0x3596a2f9 UIApplicationMain + 1121
17                                 0x00005233 main (main.m:14)

回答1:

I had the same crash. It turned out to be because we were animating a controller with [controller setContentOffset:newPt animated:YES], and we implemented the scrollViewDidScroll delegate method on the controller. Clicking a button on the screen let you advance to another controller, so if a user managed to click the button while the animation was in progress, we would hit the original poster's crash. The solution is simply to set the delegate to nil in dealloc.



回答2:

The SIGSEGV signal is sent to a process when it makes an invalid virtual memory reference, or segmentation fault. (see Wikipedia)

So you are accessing an object that likely has been released. As this is an during an animation, maybe you defined a selector to be invoked after the animation finished or something like that? That would be were I would starting looking.



回答3:

You might want to take a look at this thread: Is there a way to cancel an animated UITableView/UIScrollView setContentOffset:animated:?

That discussion suggests it might be a delegate that is dealloc'd before the scrollview sends the animation ended message.