We receive some reports for crashes in UIWebSelectSinglePicker. We guess it's due to an empty datasource array. This occurs in a webview though. How can we work around this? would prefer a native only solution
edit
happens only on iphones, running both iOS7 and iOS8
1 CoreFoundation __exceptionPreprocess + 127
2 libobjc.A.dylib objc_exception_throw + 36
3 CoreFoundation -[__NSArrayM objectAtIndex:] + 228
4 UIKit -[UIWebSelectSinglePicker pickerView:didSelectRow:inComponent:] + 56
5 UIKit -[UIPickerView _sendSelectionChangedForComponent:notify:] + 90
6 UIKit -[UIPickerTableView _scrollingFinished] + 152
7 UIKit -[UIScrollView(UIScrollViewInternal) _stopScrollDecelerationNotify:] + 842
8 UIKit -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 502
9 UIKit -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:] + 28
10 UIKit -[UIScrollView _smoothScrollWithUpdateTime:] + 208
11 QuartzCore CA::Display::DisplayLinkItem::dispatch() + 96
12 QuartzCore CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 364
13 IOMobileFramebuffer IOMobileFramebufferVsyncNotifyFunc + 88
14 IOKit IODispatchCalloutFromCFMessage + 254
15 CoreFoundation __CFMachPortPerform + 130
16 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
17 CoreFoundation __CFRunLoopDoSource1 + 344
18 CoreFoundation __CFRunLoopRun + 1606
19 CoreFoundation CFRunLoopRunSpecific + 474
20 CoreFoundation CFRunLoopRunInMode + 104
21 GraphicsServices GSEventRunModal + 134
22 UIKit UIApplicationMain + 1438
23 MYAPP main (main.m:16)
24 libdyld.dylib start + 0
I would guess this is related to another issue here on SO
There is an issue with the WebView and system controls triggered from HTML.
I think there is no link with UIWebSelectSinglePicker. I think you are trying to access to an object at an index outside the range of your array.
To prevent this you can add something like:
if(index < [self.myArray count] && [self.myArray count] > 0){
id myobject = [self.myArray objectAtIndex:index];
// do what you want here with your object
}
To debug this kind of issue and find where it happens, try to add a symbolic breakpoint:
Select the breakpoint navigator
click on "+"
"add symbolic breakpoint"
add "objectAtIndex" in the symbol field
Related
My app relatively often crashes with SIGSEGV. Unfortunately, I can not reproduce the crash and only see crash reports in Hockeyapp. I tried turning zombies on, too.
Looking at the crash report it seems that app crashes when processing touches (when user scrolling or something like this). No my app code mentioned in the stack trace.
The question is: how is it possible to have memory issue in this scenario? What would you recommend to reproduce and fix the issue?
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x71a86113
Crashed Thread: 0
Application Specific Information:
objc_msgSend() selector name: convertPoint:fromLayer:
Thread 0 Crashed:
0 libobjc.A.dylib 0x2106fae6 objc_msgSend_stret + 6
1 UIKit 0x25e7a349 -[UIView(Geometry) convertPoint:fromView:] + 98
2 UIKit 0x25e7e987 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 104
3 CoreFoundation 0x217e8279 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 86
4 CoreFoundation 0x217e81a7 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 248
5 UIKit 0x25e7e447 -[UIView(Geometry) hitTest:withEvent:] + 492
6 UIKit 0x26146f0d -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 62
7 UIKit 0x25e7e9bd __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 158
8 CoreFoundation 0x217e8279 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 86
9 CoreFoundation 0x217e81a7 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 248
10 UIKit 0x25e7e447 -[UIView(Geometry) hitTest:withEvent:] + 492
11 UIKit 0x26146f0d -[UIView(Geometry) _hitTest:withEvent:windowServerHitTestWindow:] + 62
12 UIKit 0x26136491 __70+[UIWindow _hitTestToPoint:forEvent:windowServerHitTestWindow:screen:]_block_invoke + 186
13 UIKit 0x25e4783f +[UIWindow _topVisibleWindowPassingTest:] + 156
14 UIKit 0x26136399 +[UIWindow _hitTestToPoint:forEvent:windowServerHitTestWindow:screen:] + 142
15 UIKit 0x26136629 -[UIWindow _targetWindowForPathIndex:atPoint:forEvent:windowServerHitTestWindow:onScreen:] + 158
16 UIKit 0x260ffb61 _UIApplicationHandleDigitizerEvent + 10982
17 UIKit 0x25e4123f _UIApplicationHandleEventQueue + 3836
18 CoreFoundation 0x21889dff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
19 CoreFoundation 0x218899ed __CFRunLoopDoSources0 + 450
20 CoreFoundation 0x21887d5b __CFRunLoopRun + 792
21 CoreFoundation 0x217d7229 CFRunLoopRunSpecific + 518
22 CoreFoundation 0x217d7015 CFRunLoopRunInMode + 106
23 GraphicsServices 0x22dc7ac9 GSEventRunModal + 158
24 UIKit 0x25eab189 UIApplicationMain + 142
25 My App. 0x0005376b main (main.m:14)
26 ??? 0x2147f873 0x0 + 0
About 10+ crash reported by crittercism.
Name: SIGSEGV
Reason: SEGV_MAPERR
Seems it is a UIScrollView/UITableView animating or scrolling issue.
How can I find the root cause?
Stack:
0
libobjc.A.dylib 0x0000000195fafbd0 objc_msgSend + 12
1
UIKit 0x00000001892b1db8 -[UIScrollView(UIScrollViewInternal) _delegateScrollViewAnimationEnded] + 64
2
UIKit 0x00000001892b1d30 -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 204
3
UIKit 0x0000000189366814 -[UIAnimator stopAnimation:] + 500
4
UIKit 0x0000000189366248 -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 332
5
QuartzCore 0x0000000188b4629c CA::Display::DisplayLinkItem::dispatch() + 28
6
QuartzCore 0x0000000188b46134 CA::Display::DisplayLink::dispatch_items() + 320
7
IOKit 0x0000000185921470 IODispatchCalloutFromCFMessage + 372
8
CoreFoundation 0x0000000184712dc4 __CFMachPortPerform + 176
9
CoreFoundation 0x0000000184727a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
10
CoreFoundation 0x00000001847279b4 __CFRunLoopDoSource1 + 432
11
CoreFoundation 0x0000000184725934 __CFRunLoopRun + 1636
12
CoreFoundation 0x00000001846512d4 CFRunLoopRunSpecific + 392
13
GraphicsServices 0x000000018de676fc GSEventRunModal + 164
14
UIKit 0x0000000189216fac UIApplicationMain + 1484
15
MyApp 0x000000010001d280 main (main.m:14)
16
libdyld.dylib 0x000000019661aa08 start + 0
I've seen this happen when a controller and/or its table is deallocated during an animation. The OS still triggers delegate methods (e.g., -scrollViewDidEndScrollingAnimation: or -scrollViewDidEndDecelerating:) when it finishes with the animation, but because the objects no longer exist things get weird.
The best fix is to nil the delegate in the controller's dealloc method.
I'm using Crittercism (SDK 4.1.2) crash reporting service to catch reports on my iOS app. i've been getting this crash many times and i've no idea why it's happening.
Name: SIGSEGV - Reason: Main
Crashed Thread
0 libobjc.A.dylib 0x397c4b26 objc_msgSend + 6
1 UIKit 0x31965a2d -[UIScrollView(UIScrollViewInternal) _scrollViewAnimationEnded:finished:] + 177
2 UIKit 0x31a0e4b3 -[UIAnimator stopAnimation:] + 471
3 UIKit 0x31a0de9d -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 285
4 UIKit 0x31a0dd7d -[UIAnimator(Static) _LCDHeartbeatCallback:] + 53
5 QuartzCore 0x315419cf _ZN2CA7Display15DisplayLinkItem8dispatchEv + 99
6 QuartzCore 0x31541779 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 345
7 IOMobileFramebuffer 0x3411b76d IOMobileFramebufferVsyncNotifyFunc + 105
8 IOKit 0x2fdd9a75 IODispatchCalloutFromCFMessage + 249
9 CoreFoundation 0x2f0b7e21 __CFMachPortPerform + 137
10 CoreFoundation 0x2f0c29df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35
11 CoreFoundation 0x2f0c297b __CFRunLoopDoSource1 + 347
12 CoreFoundation 0x2f0c114f __CFRunLoopRun + 1399
13 CoreFoundation 0x2f02bc27 CFRunLoopRunSpecific + 523
14 CoreFoundation 0x2f02ba0b CFRunLoopRunInMode + 107
15 GraphicsServices 0x33cff283 GSEventRunModal + 139
16 UIKit 0x318cf049 UIApplicationMain + 1137
17 AppName 0x000b1fef main + 67
Not sure if this is the case for you, but I've had a similar crash caused by a button in an UIView trying to invoke a callback method on a already released object. The UI was displayed, and then the object was released.
Since i received comments of crashes but the app never crashes for me, I now use critterism to hunt down crashes.
I received one report that pointed to me to an error by me. It was easy, since the method name was given and i
could look in my code what might crash. So far, so good.
But i also have the following two that puzzle me.
To me it looks like the app crashes in some internal apple library.( Most likely due to me feeding it some broken stuff...)
There is no call from my code in the crash, so where do start looking?
Does anyone understand these crashes?
Any idea how i can catch these and maybe get some more crash info?
No.1:
0 CoreFoundation 0x3585f88f __exceptionPreprocess + 162
1 libobjc.A.dylib 0x37c06259 objc_exception_throw + 32
2 CoreFoundation 0x35862a9b -[NSObject doesNotRecognizeSelector:] + 174
3 CoreFoundation 0x35861915 ___forwarding___ + 300
4 CoreFoundation 0x357bc650 _CF_forwarding_prep_0 + 48
5 UIKit 0x332f3efb -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 546
6 UIKit 0x332f2f39 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 916
7 UIKit 0x332f2763 -[UITableView layoutSubviews] + 206
8 UIKit 0x33296f37 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 182
9 CoreFoundation 0x357be1fb -[NSObject performSelector:withObject:] + 42
10 QuartzCore 0x3268eaa5 -[CALayer layoutSublayers] + 216
11 QuartzCore 0x3268e6bd _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 216
12 QuartzCore 0x32692843 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 226
13 QuartzCore 0x3269257f _ZN2CA11Transaction6commitEv + 314
14 QuartzCore 0x326ba911 _ZN2CA11Transaction5flushEv + 44
15 QuartzCore 0x326ba8e3 +[CATransaction flush] + 34
16 UIKit 0x332a1fb1 _afterCACommitHandler + 52
17 CoreFoundation 0x35833b1b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
18 CoreFoundation 0x35831d57 __CFRunLoopDoObservers + 258
19 CoreFoundation 0x358320b1 __CFRunLoopRun + 760
20 CoreFoundation 0x357b54a5 CFRunLoopRunSpecific + 300
21 CoreFoundation 0x357b536d CFRunLoopRunInMode + 104
22 GraphicsServices 0x37451439 GSEventRunModal + 136
23 UIKit 0x332c1cd5 UIApplicationMain + 1080
24 Wohnungssuche 0x000d5218 start + 40
No. 2:
Thread: Unknown Name (Crashed)
0 libobjc.A.dylib 0x35beb5d0 objc_msgSend + 16 + 15
1 UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
2 UIKit 0x39f95361 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1317 + 1316
3 UIKit 0x39fac7ff -[UITableView layoutSubviews] + 207 + 206
4 UIKit 0x39f68897 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 259 + 258
5 QuartzCore 0x34ab74eb -[CALayer layoutSublayers] + 215 + 214
6 QuartzCore 0x34ab708d _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 461 + 460
7 QuartzCore 0x34ab7fb1 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 17 + 16
8 QuartzCore 0x34ab799b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 239 + 238
9 QuartzCore 0x34ab77ad _ZN2CA11Transaction6commitEv + 317 + 316
10 QuartzCore 0x34aee7df _ZN2CA7Display11DisplayLink8dispatchEyy + 255 + 254
11 QuartzCore 0x34aee6d9 _ZN2CA7Display16IOMFBDisplayLink8callbackEP21__IOMobileFramebufferyyyPv + 65 + 64
12 IOMobileFramebuffer 0x375f0fd7 IOMobileFramebufferVsyncNotifyFunc + 155 + 154
13 IOKit 0x3282a5ad IODispatchCalloutFromCFMessage + 193 + 192
14 CoreFoundation 0x3918288b __CFMachPortPerform + 119 + 118
15 CoreFoundation 0x3918d3e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 35 + 34
16 CoreFoundation 0x3918d38b __CFRunLoopDoSource1 + 139 + 138
17 CoreFoundation 0x3918c20f __CFRunLoopRun + 1383 + 1382
18 CoreFoundation 0x390ff23d CFRunLoopRunSpecific + 357 + 356
19 CoreFoundation 0x390ff0c9 CFRunLoopRunInMode + 105 + 104
20 GraphicsServices 0x3344933b GSEventRunModal + 75 + 74
21 UIKit 0x39fb9291 UIApplicationMain + 1121 + 1120
Thanks for your help!
The crash point in both cases is the same:
UIKit 0x39fb0541 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 409 + 408
In the first case, the table view was trying to call a method on an instance that does not implement said method. The second crash was caused by trying to message garbage.
Thus, the most likely conclusion is that both crashes are symptoms of a single problem; you have an object that is being prematurely released or over-released.
In particular, your table view's data source is being released before or while a table is reloading.
I suspect that UITableView is trying to call the data source's method to create a cell. You could confirm this by setting a breakpoint on said method and looking at the stack trace. If my bet is correct, you'll see the _createPreparedCellForGlobal... method in the trace.
Without knowing details of your app, hard to say. Most likely, this is timing related issue between data being loaded on the screen and the user doing something that causes a request to be canceled earlier than the table view is done loading, causing your data source to be deallocated out from under the table (which can happen because the table view has an assign reference to your object; a non-retaining reference).
To try and reproduce, focus on:
• slow network connection or variable bandwidth (if your app is client/server)
• do things the user might do that causes operations to cancel
• quickly navigate between views without waiting for the update to complete drawing
In your comments, you mention that you are trying on "two different iPhones". Try on other device types and across different network configurations.
I am testing my app out, pushing it pretty hard, and I'm getting it to crash (black screen, image doesn't save, drops back to springboard). However, I get no crash reports logged in the console. When I test using profiler all I get is a message saying the target died, but it gives no clues.
In the organiser I got the device crash logs which gives me this which I believe is telling me I'm sending a message to something I've released (objc-msgSend + 22)? Am I on the right track here?
---
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x576e6f69
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x34f8ef7e objc_msgSend + 22
1 CoreFoundation 0x371d7e90 CFRetain + 76
2 CoreFoundation 0x371e1b74 +[__NSArrayI __new::] + 48
3 CoreFoundation 0x371e1a8e -[__NSPlaceholderArray initWithObjects:count:] + 294
4 CoreFoundation 0x371e9394 -[NSArray initWithArray:range:copyItems:] + 756
5 CoreFoundation 0x371fcd5a +[NSArray arrayWithArray:] + 66
6 AVFoundation 0x335da766 -[AVCaptureSession outputs] + 146
7 AVFoundation 0x335de26e -[AVCaptureSession _doDidStop:] + 38
8 AVFoundation 0x335dfaea -[AVCaptureSession _handleNotification:payload:] + 2002
9 AVFoundation 0x335d8af6 avcaptureSessionFigRecorderNotification + 1202
10 AVFoundation 0x335fafd8 AVCMNotificationDispatcherCallback + 184
11 CoreFoundation 0x3725b7c8 __CFNotificationCenterAddObserver_block_invoke_0 + 116
12 CoreFoundation 0x3725b540 ___CFXNotificationPost_block_invoke_0 + 64
13 CoreFoundation 0x371e7090 _CFXNotificationPost + 1400
14 CoreFoundation 0x371ef1c6 CFNotificationCenterPostNotification + 102
15 CoreMedia 0x366eeeb0 CMNotificationCenterPostNotification + 112
16 Celestial 0x374b08a2 FigRecorderRemoteCallbacksServer_NotificationIsPending + 478
17 Celestial 0x374b06ba _XNotificationIsPending + 54
18 Celestial 0x374b0678 figrecordercallbacks_server + 92
19 Celestial 0x374af642 remrec_ClientPortCallBack + 146
20 CoreFoundation 0x37258f0c __CFMachPortPerform + 356
21 CoreFoundation 0x3726351c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
22 CoreFoundation 0x372634be __CFRunLoopDoSource1 + 134
23 CoreFoundation 0x3726230c __CFRunLoopRun + 1364
24 CoreFoundation 0x371e549e CFRunLoopRunSpecific + 294
25 CoreFoundation 0x371e5366 CFRunLoopRunInMode + 98
26 AVFoundation 0x335ef4d0 -[AVRunLoopCondition _waitInMode:untilDate:] + 348
27 AVFoundation 0x335ef36c -[AVRunLoopCondition waitUntilDate:inMode:] + 20
28 AVFoundation 0x335dc13a -[AVCaptureSession _stopPreviewing] + 438
29 AVFoundation 0x335dc2d6 -[AVCaptureSession _setRunning:] + 166
30 AVFoundation 0x335dbe42 -[AVCaptureSession stopRunning] + 274
31 zApp 0x0007e1ce 0x79000 + 20942
32 UIKit 0x30fa5b8e -[UIViewController _setViewAppearState:isAnimating:] + 138
33 UIKit 0x30fff8a8 -[UIViewController beginAppearanceTransition:animated:] + 184
34 UIKit 0x310468be -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 4098
35 UIKit 0x31045360 -[UIViewController presentViewController:withTransition:completion:] + 3116
36 UIKit 0x310a06a0 -[UIViewController presentModalViewController:animated:] + 24
37 CoreFoundation 0x371e93f6 -[NSObject performSelector:withObject:withObject:] + 46
38 UIKit 0x30f7ee00 -[UIApplication sendAction:to:from:forEvent:] + 56
39 UIKit 0x30f7edbc -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 24
40 UIKit 0x30f7ed9a -[UIControl sendAction:to:forEvent:] + 38
41 UIKit 0x30f7eb0a -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 486
42 UIKit 0x30f7f442 -[UIControl touchesEnded:withEvent:] + 470
43 UIKit 0x30f7d924 -[UIWindow _sendTouchesForEvent:] + 312
44 UIKit 0x30f7d312 -[UIWindow sendEvent:] + 374
45 UIKit 0x30f6368e -[UIApplication sendEvent:] + 350
46 UIKit 0x30f62f34 _UIApplicationHandleEvent + 5820
47 GraphicsServices 0x339a5224 PurpleEventCallback + 876
48 CoreFoundation 0x3726351c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
49 CoreFoundation 0x372634be __CFRunLoopDoSource1 + 134
50 CoreFoundation 0x3726230c __CFRunLoopRun + 1364
51 CoreFoundation 0x371e549e CFRunLoopRunSpecific + 294
52 CoreFoundation 0x371e5366 CFRunLoopRunInMode + 98
53 GraphicsServices 0x339a4432 GSEventRunModal + 130
54 UIKit 0x30f91cce UIApplicationMain + 1074
55 zApp 0x0007ffa6 0x79000 + 28582
56 zApp 0x0007a680 0x79000 + 5760
If you suspect that you are overreleasing something, try running your app with NSZombie enabled. (how to enable NSZombie)
You can set exception breakpoint to print backtrace in console.
sometimes that happens when you set an object as an observer for notifications, like
[[NSNotificationCenter defaultCenter] addObserver //details
and don't remove it from the observers list when it's released.
the system tries to send a message to it, and the app crashes because it's not there.
try adding
[[NSNotificationCenter defaultCenter] removeObserver:self];
in the dealloc function. (even if you're working with arc, create a dealloc function, and write that in it).
good luck