i've a problem with ios 4.2.1 and uidatepicker.
My app is running on iPad and the picker is inside an UIPopoverController.
On iOS 3.2 the app works fine.
When i spin any wheel of the picker, the app crash with this stack trace:
* Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSMutableArray objectAtIndex:]: index 2147483647 beyond bounds [0 .. 2]'
** Call stack at first throw:
(
0 CoreFoundation 0x01165be9 exceptionPreprocess + 185
1 libobjc.A.dylib 0x012ba5c2 objc_exception_throw + 47
2 CoreFoundation 0x0115b6e5 -[__NSArrayM objectAtIndex:] + 261
3 UIKit 0x002e9b74 -[UIPickerView reloadComponent:] + 62
4 UIKit 0x004cb6a9 -[UIDatePickerView _updateDateOrTime] + 1273
5 UIKit 0x004cb114 -[UIDatePickerView pickerView:didSelectRow:inComponent:] + 42
6 UIKit 0x002e9194 -[UIPickerView _sendSelectionChangedForComponent:] + 100
7 UIKit 0x002e8f75 -[UIPickerView scrollerDidEndSmoothScrolling:] + 75
8 UIKit 0x004924c7 -[UIScroller(Internal) _stopScrollingNotify:dealloc:pin:] + 692
9 UIKit 0x00493ed0 -[UIScroller(Static) _smoothScroll:] + 4743
10 UIKit 0x0048a188 ScrollerHeartbeatCallback + 129
11 GraphicsServices 0x01a9d447 HeartbeatTimerCallback + 35
12 CoreFoundation 0x01146fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 19
13 CoreFoundation 0x01148594 __CFRunLoopDoTimer + 1220
14 CoreFoundation 0x010a4cc9 __CFRunLoopRun + 1817
15 CoreFoundation 0x010a4240 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x010a4161 CFRunLoopRunInMode + 97
17 GraphicsServices 0x01a9a268 GSEventRunModal + 217
18 GraphicsServices 0x01a9a32d GSEventRun + 115
19 UIKit 0x0030242e UIApplicationMain + 1160
20 Agenda 0x0000245c main + 102
21 Agenda 0x000023ed start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Any ideas?
The problem is with your array range.
Related
I have the following crash that I can't replicate on demand but does happen enough to get noticed by the users.
This crash report has been symbolicated as well. How would you find out the cause!!! This only seems to happen on 4.1
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x9f069184
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x000027d8 objc_msgSend + 16
1 CoreFoundation 0x0007d749 ____CFXNotificationPost_old_block_invoke_1 + 45
2 libSystem.B.dylib 0x000d5984 _dispatch_call_block_and_release + 20
3 libSystem.B.dylib 0x000d66b0 _dispatch_continuation_pop + 72
4 libSystem.B.dylib 0x000d69fc _dispatch_main_queue_callback_4CF + 220
5 CoreFoundation 0x0002789b __CFRunLoopRun + 1335
6 CoreFoundation 0x00027277 CFRunLoopRunSpecific + 231
7 CoreFoundation 0x0002717f CFRunLoopRunInMode + 59
8 GraphicsServices 0x000045f3 GSEventRunModal + 115
9 GraphicsServices 0x0000469f GSEventRun + 63
10 UIKit 0x00004123 -[UIApplication _run] + 403
11 UIKit 0x0000212f UIApplicationMain + 671
12 MyApp 0x000024e3 main (main.m:17)
I have since managed to get a little more info, but not much.
2012-02-12 18:03:04.556 MyApp[462:307] (null): unrecognized selector sent to class 0x3e0a360c
2012-02-12 18:03:04.618 MyApp[462:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '(null): unrecognized selector sent to class 0x3e0a360c'
*** Call stack at first throw:
(
0 CoreFoundation 0x33506ed3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x30412811 objc_exception_throw + 24
2 CoreFoundation 0x335086ff +[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x334b01d9 ___forwarding___ + 508
4 CoreFoundation 0x334aff90 _CF_forwarding_prep_0 + 48
5 Foundation 0x302a86b3 _nsnote_callback + 142
6 CoreFoundation 0x334e4749 ____CFXNotificationPost_old_block_invoke_1 + 44
7 libSystem.B.dylib 0x31d05984 _dispatch_call_block_and_release + 20
8 libSystem.B.dylib 0x31d066b0 _dispatch_continuation_pop + 72
9 libSystem.B.dylib 0x31d069fc _dispatch_main_queue_callback_4CF + 220
10 CoreFoundation 0x3348e89b __CFRunLoopRun + 1334
11 CoreFoundation 0x3348e277 CFRunLoopRunSpecific + 230
12 CoreFoundation 0x3348e17f CFRunLoopRunInMode + 58
13 GraphicsServices 0x31b5e5f3 GSEventRunModal + 114
14 GraphicsServices 0x31b5e69f GSEventRun + 62
15 UIKit 0x341bd123 -[UIApplication _run] + 402
16 UIKit 0x341bb12f UIApplicationMain + 670
Now all of my addObservers are block based so I can't see why it would lead to an unrecognised selector.
This way won't help us much while Debugging crash. I found one of the best way to Debug the code for Crash. Follow the link for debugging technique:
https://cocoadev.com/DebuggingAutorelease.html
You need to analyze your Console very carefully to see actually why the Crash occurs. This helped me in almost all of the Code that are without ARC enabled.
We have an PhoneGap application that runs perfectly okay when using the simulator but once running this in the actual iPhone connected to mac we get an exception (errors below). Note the application was working perfectly fine before upgrade to PhoneGap0.9.6/
objc[356]: Class Connection is implemented in both /System/Library/PrivateFrameworks/Message.framework/Message and /var/mobile/Applications/D1D682A1-010B-4AE9-8761-4D553FCF8089/Frank151.app/Frank151. One of the two will be used. Which one is undefined.
[Switching to process 13059 thread 0x0]
2011-07-08 18:00:45.355 Frank151[356:707] -[Connection initWithWebView:]: unrecognized selector sent to instance 0x17e4e0
2011-07-08 18:00:45.378 Frank151[356:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Connection initWithWebView:]: unrecognized selector sent to instance 0x17e4e0'
*** Call stack at first throw:
(
0 CoreFoundation 0x3166564f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x35180c5d objc_exception_throw + 24
2 CoreFoundation 0x316691bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x31668649 ___forwarding___ + 508
4 CoreFoundation 0x315df180 _CF_forwarding_prep_0 + 48
5 Frank151 0x00017469 -[PhoneGapDelegate getCommandInstance:] + 164
6 Frank151 0x00002f7f -[AppDelegate getCommandInstance:] + 62
7 Frank151 0x00016807 -[PhoneGapDelegate deviceProperties] + 234
8 Frank151 0x00016475 -[PhoneGapDelegate webViewDidFinishLoad:] + 28
9 Frank151 0x00003071 -[AppDelegate webViewDidFinishLoad:] + 212
10 UIKit 0x318a9061 -[UIWebView webView:didFinishLoadForFrame:] + 244
11 UIKit 0x318a8427 -[UIWebViewWebViewDelegate webView:didFinishLoadForFrame:] + 22
12 CoreFoundation 0x316687a4 __invoking___ + 68
13 CoreFoundation 0x315e043d -[NSInvocation invoke] + 108
14 CoreFoundation 0x315e00d9 -[NSInvocation invokeWithTarget:] + 36
15 WebKit 0x345887bd -[_WebSafeForwarder forwardInvocation:] + 408
16 CoreFoundation 0x3166868d ___forwarding___ + 576
17 CoreFoundation 0x315df180 _CF_forwarding_prep_0 + 48
18 CoreFoundation 0x316687a4 __invoking___ + 68
19 CoreFoundation 0x315e043d -[NSInvocation invoke] + 108
20 WebCore 0x36c39c3d _ZL11SendMessageP12NSInvocation + 16
21 WebCore 0x36cdcadf _ZL20HandleDelegateSourcePv + 66
22 CoreFoundation 0x3163ca79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
23 CoreFoundation 0x3163e75f __CFRunLoopDoSources0 + 382
24 CoreFoundation 0x3163f4eb __CFRunLoopRun + 230
25 CoreFoundation 0x315cfec3 CFRunLoopRunSpecific + 230
26 CoreFoundation 0x315cfdcb CFRunLoopRunInMode + 58
27 GraphicsServices 0x30f4e41f GSEventRunModal + 114
28 GraphicsServices 0x30f4e4cb GSEventRun + 62
29 UIKit 0x316f5d69 -[UIApplication _run] + 404
30 UIKit 0x316f3807 UIApplicationMain + 670
31 Frank151 0x00002caf main + 78
32 Frank151 0x00002c5c start + 40
)
terminate called after throwing an instance of 'NSException'
[Switching to process 11779 thread 0x0]
(gdb)
UPDATE: After not much luck after trying many things we decided to downgrade the application to PG 0.9.5.1 and it worked with no issues. Not sure of the cause but something to do with PhoneGap 0.9.6 upgrade.
Start by disabling any plug ins......
webView may be referring to ChildBrowser Plugin.
When I search on TableView through TextDidChange which calls handleSearchTerm subroutine, it perfectly works. However, I removed TextDidChange and use SearchButtonClicked to update tableView (use same subroutine),it doesn't update TableView properly and crash when scroll(out of bound index in cellForRowAtIndex) even though datasource has been changed in subroutine. Any idea?
[78515:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (8) beyond bounds (8)'
*** Call stack at first throw:
(
0 CoreFoundation 0x00db8be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f0d5c2 objc_exception_throw + 47
2 CoreFoundation 0x00d71628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d7159a +[NSException raise:format:] + 58
4 CoreFoundation 0x00dae8c9 _NSArrayRaiseBoundException + 121
5 CoreFoundation 0x00db0027 -[__NSCFArray objectAtIndex:] + 87
6 DrinkGuide_v1.0 0x00005d6c -[AllDrinkTableViewController tableView:cellForRowAtIndexPath:] + 371
7 UIKit 0x003357fa -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
8 UIKit 0x0032b77f -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
9 UIKit 0x00340450 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
10 UIKit 0x00338538 -[UITableView layoutSubviews] + 242
11 QuartzCore 0x01c76451 -[CALayer layoutSublayers] + 181
12 QuartzCore 0x01c7617c CALayerLayoutIfNeeded + 220
13 QuartzCore 0x01c6f37c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
14 QuartzCore 0x01c6f0d0 _ZN2CA11Transaction6commitEv + 292
15 QuartzCore 0x01c9f7d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
16 CoreFoundation 0x00d99fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
17 CoreFoundation 0x00d2f0e7 __CFRunLoopDoObservers + 295
18 CoreFoundation 0x00cf7bd7 __CFRunLoopRun + 1575
19 CoreFoundation 0x00cf7240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x00cf7161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x016ed268 GSEventRunModal + 217
22 GraphicsServices 0x016ed32d GSEventRun + 115
23 UIKit 0x002d042e UIApplicationMain + 1160
24 DrinkGuide_v1.0 0x0000298c main + 102
25 DrinkGuide_v1.0 0x0000291d start + 53
)
terminate called after throwing an instance of 'NSException'
I think crash is caused by cellForRowAtIndexPath, can you please post code for following methods :
cellForRowAtIndexPath
SearchButtonClicked
yourSubroutine you are calling
also mention your array or collection from which you are loading your table.
Thanks,
as per your crash log it seems you are retuning wrong no of cells in you noOfcellsInsection method. You are getting array out of bounds error.When you are doing search make a flag true and according to that flag return no of rows for the table view using your filtered array's count.
I am developing an iPad application with SDK4.2. I have a very strange error when touching any textField in my application. The first time I touch, the keyboard is shown, but when a second touch is done in the object I obtain following trace.
And it occurs also in any TextField shown in a HTML page with a UIWebView object.
Any ideas?
I am really confused with this.. Thanks in advance!
2010-12-17 11:53:11.697 BancoPopular[48914:207] *** Assertion failure in -[UIButtonLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1447.6.4/UILabel.m:314
2010-12-17 11:53:11.699 BancoPopular[48914:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
*** Call stack at first throw:
(
0 CoreFoundation 0x01730be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x018855c2 objc_exception_throw + 47
2 CoreFoundation 0x016e9628 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0013947b -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x0045d1dc -[UILabel setTextColor:] + 164
5 UIKit 0x0052177b -[UIButton layoutSubviews] + 1337
6 UIKit 0x005f3420 -[UICalloutBarButton layoutSubviews] + 54
7 QuartzCore 0x011a4451 -[CALayer layoutSublayers] + 181
8 QuartzCore 0x011a417c CALayerLayoutIfNeeded + 220
9 QuartzCore 0x011a4088 -[CALayer layoutIfNeeded] + 111
10 UIKit 0x0051f2ff -[UIButton titleLabel] + 81
11 UIKit 0x005f81d1 -[UICalloutBarButton setContentScale:] + 141
12 UIKit 0x005f6c5d -[UICalloutBar _updateVisibleItems] + 2240
13 UIKit 0x005f2970 -[UICalloutBar appear] + 211
14 UIKit 0x005eaaa9 -[UITextSelectionView showCommandsWithReplacements:] + 291
15 Foundation 0x000bd7f6 __NSFireDelayedPerform + 441
16 CoreFoundation 0x01711fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
17 CoreFoundation 0x01713594 __CFRunLoopDoTimer + 1220
18 CoreFoundation 0x0166fcc9 __CFRunLoopRun + 1817
19 CoreFoundation 0x0166f240 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x0166f161 CFRunLoopRunInMode + 97
21 GraphicsServices 0x01e25268 GSEventRunModal + 217
22 GraphicsServices 0x01e2532d GSEventRun + 115
23 UIKit 0x0034d42e UIApplicationMain + 1160
24 BancoPopular 0x0000292e main + 84
25 BancoPopular 0x000028d1 start + 53
26 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Look carefully what exception was about. It said "reason: 'Invalid parameter not satisfying: color'", somewhere in your code, you provide wrong parameter that is supposed to be valid colors. Apparently, it seems like you use UIButton with label and set its color but not valid.
My guess is that you have some object going away somewhere, and that object contains the "color" value.
Most likely you received an autoreleased value from some call and did not retain it, so it went "poof" when the UI came up for air.
I'm used to Java programming where an error is thrown and it tells you at what line the error was thrown from which file. But with Objective-C in XCode, I can't ever tell where the error comes from. How can I figure out where the error came from? Here is an example of a crash error:
2011-01-04 10:36:31.645 TestGA[69958:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x01121be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012765c2 objc_exception_throw + 47
2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261
3 TestGA 0x000548d8 -[S7GraphView drawRect:] + 5763
4 UIKit 0x003e16eb -[UIView(CALayerDelegate) drawLayer:inContext:] + 426
5 QuartzCore 0x00ec89e9 -[CALayer drawInContext:] + 143
6 QuartzCore 0x00ec85ef _ZL16backing_callbackP9CGContextPv + 85
7 QuartzCore 0x00ec7dea CABackingStoreUpdate + 2246
8 QuartzCore 0x00ec7134 -[CALayer _display] + 1085
9 QuartzCore 0x00ec6be4 CALayerDisplayIfNeeded + 231
10 QuartzCore 0x00eb938b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 325
11 QuartzCore 0x00eb90d0 _ZN2CA11Transaction6commitEv + 292
12 QuartzCore 0x00ee97d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
13 CoreFoundation 0x01102fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
14 CoreFoundation 0x010980e7 __CFRunLoopDoObservers + 295
15 CoreFoundation 0x01060bd7 __CFRunLoopRun + 1575
16 CoreFoundation 0x01060240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x01060161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01932268 GSEventRunModal + 217
19 GraphicsServices 0x0193232d GSEventRun + 115
20 UIKit 0x003b842e UIApplicationMain + 1160
21 TestGA 0x00001cd8 main + 102
22 TestGA 0x00001c69 start + 53
23 ??? 0x00000001 0x0 + 1
So from looking at this, where is the error coming from and from which class is it coming from?
2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261
An array you are using with that method is out of range.. In this case the array is empty and you try to get a value from a point that doesn't exist..
But i agree with you that it is pretty hard to find.. If you use the [white and yellow]-button next to the button you use to open the console you can check the debugger.. This way you can click on the " 2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261" and see where it goes wrong..
It might be a good idea to refer to the Xcode debugging guide at Apple.com to learn more about how to debug your iOS applications.