I have an NSTimer that calls the checkStatus function every 2 seconds:
-(void) checkStatus
{
#autoreleasepool
{
self.lblconnectionStatus.backgroundColor=RGB(0,153,0);
}
}
The app crashes on: self.lblconnectionStatus.backgroundColor=RGB(0,153,0);
Here is the error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x02244466 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x01af5a97 objc_exception_throw + 44
2 CoreFoundation 0x020fb5a1 -[__NSArrayM insertObject:atIndex:] + 881
3 CoreFoundation 0x020fb201 -[__NSArrayM addObject:] + 65
4 UIKit 0x00ad559c PushNextClassForSettingIMP + 383
5 UIKit 0x00acce56 TaggingAppearanceObjectSetterIMP + 50
6 GIG-iPad 0x0017ddcb -[TradeController checkStatus] + 763
7 Foundation 0x016f6607 -[NSThread main] + 76
8 Foundation 0x016f6560 __NSThread__main__ + 1326
9 libsystem_pthread.dylib 0x02e20ecf _pthread_body + 138
10 libsystem_pthread.dylib 0x02e20e45 _pthread_body + 0
11 libsystem_pthread.dylib 0x02e1ef0e thread_start + 34
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Maybe "checkStatus" function have like,
[xxxx addObject:yyy];
Problem is yyy is nil so, Try this.
if (yyy != nil) {
[xxxx addObject:yyy];
}
Related
WKWebView crashing the app while loading contents from URL. It's a 3DS page which is working fine for iOS < 14.
2021-02-22 16:10:53.366952+0530 OrderMealCustomer[6826:326746] -[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000125e6a0
2021-02-22 16:10:53.586212+0530 OrderMealCustomer[6826:326746] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000125e6a0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000113784af6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x0000000113e2fe78 objc_exception_throw + 48
2 CoreFoundation 0x00000001137936f7 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x0000000113789036 ___forwarding___ + 1489
4 CoreFoundation 0x000000011378b068 _CF_forwarding_prep_0 + 120
5 JavaScriptCore 0x0000000112ede0ac _ZN3WTF6StringC2EP8NSString + 60
6 WebCore 0x000000011fd5a637 _ZN7WebCore28getDefaultWebCryptoMasterKeyERN3WTF6VectorIhLm0ENS0_15CrashOnOverflowELm16ENS0_10FastMallocEEE + 839
7 WebKit 0x0000000110fd4039 _ZN6WebKit15NavigationState16NavigationClient18webCryptoMasterKeyERNS_12WebPageProxyE + 65
8 WebKit 0x000000011108274b _ZN6WebKit12WebPageProxy13wrapCryptoKeyERKN3WTF6VectorIhLm0ENS1_15CrashOnOverflowELm16ENS1_10FastMallocEEEONS1_17CompletionHandlerIFvbOS5_EEE + 111
9 WebKit 0x000000011135e946 _ZN6WebKit12WebPageProxy21didReceiveSyncMessageERN3IPC10ConnectionERNS1_7DecoderERNSt3__110unique_ptrINS1_7EncoderENS6_14default_deleteIS8_EEEE + 1972
10 WebKit 0x0000000110d6863c _ZN3IPC18MessageReceiverMap19dispatchSyncMessageERNS_10ConnectionERNS_7DecoderERNSt3__110unique_ptrINS_7EncoderENS5_14default_deleteIS7_EEEE + 138
11 WebKit 0x000000011109df8c _ZN6WebKit15WebProcessProxy21didReceiveSyncMessageERN3IPC10ConnectionERNS1_7DecoderERNSt3__110unique_ptrINS1_7EncoderENS6_14default_deleteIS8_EEEE + 32
12 WebKit 0x0000000110d48c65 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 755
13 WebKit 0x0000000110d49ddd _ZN3WTF6Detail15CallableWrapperIZN3IPC10Connection16SyncMessageState22processIncomingMessageERS3_RNSt3__110unique_ptrINS2_7DecoderENS6_14default_deleteIS8_EEEEE3$_1vJEE4callEv + 541
14 JavaScriptCore 0x0000000112ed796d _ZN3WTF7RunLoop11performWorkEv + 573
15 JavaScriptCore 0x0000000112ed847a _ZN3WTF7RunLoop11performWorkEPv + 26
16 CoreFoundation 0x00000001136f338a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x00000001136f3282 __CFRunLoopDoSource0 + 180
18 CoreFoundation 0x00000001136f2764 __CFRunLoopDoSources0 + 248
19 CoreFoundation 0x00000001136ecf2f __CFRunLoopRun + 878
20 CoreFoundation 0x00000001136ec6d6 CFRunLoopRunSpecific + 567
21 GraphicsServices 0x000000011e364db3 GSEventRunModal + 139
22 UIKitCore 0x0000000117893cf7 -[UIApplication _run] + 912
23 UIKitCore 0x0000000117898ba8 UIApplicationMain + 101
24 libswiftUIKit.dylib 0x0000000114cad5f2 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
25 OrderMealCustomer 0x000000010acfbcfa $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 122
26 OrderMealCustomer 0x000000010acfbc6e $s17OrderMealCustomer11AppDelegateC5$mainyyFZ + 46
27 OrderMealCustomer 0x000000010acfe599 main + 41
28 libdyld.dylib 0x0000000114f1f3e9 start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000125e6a0'
It might be because of content has slash(/) in it.
The issue is specific to iOS 14.x.
I am working around with Xcode 8. But I have one problem, specifically when I try to change the device type in simulator, it crashes and I get a crash message
*** Terminating app due to uncaught exception 'NSRangeException', reason:
'*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x0000000103b5934b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001035ba21e objc_exception_throw + 48
2 CoreFoundation 0x0000000103a8af1b -[__NSArrayM objectAtIndex:] + 203
3 Mahroosa 0x0000000102e207c7 -[MainViewController viewSliderControllerAtIndex:] + 151
4 Mahroosa 0x0000000102e21117 -[MainViewController LoadSlides] + 1495
5 Mahroosa 0x0000000102e25b32 -[MainViewController TimerTick:] + 98
6 Foundation 0x0000000103115144 __NSFireTimer + 83
7 CoreFoundation 0x0000000103aeb964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
8 CoreFoundation 0x0000000103aeb5f3 __CFRunLoopDoTimer + 1075
9 CoreFoundation 0x0000000103aeb17a __CFRunLoopDoTimers + 250
10 CoreFoundation 0x0000000103ae2f01 __CFRunLoopRun + 2065
11 CoreFoundation 0x0000000103ae2494 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x0000000108f2ca6f GSEventRunModal + 161
13 UIKit 0x00000001048ebf34 UIApplicationMain + 159
14 Mahroosa 0x0000000102e34a2f main + 111
15 libdyld.dylib 0x000000010628868d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Any ideas?.
Thanks in advance!
I have an error when running my app after I upgrade the ReactNative to 0.17
I was work fine with 0.13
Error code is
2016-01-04 12:22:37.405 myapp [16916:350051] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringFromIndex:]: Index 175 out of bounds; string length 174'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ea9ce65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010dca0deb objc_exception_throw + 48
2 CoreFoundation 0x000000010ea9cd9d +[NSException raise:format:] + 205
3 Foundation 0x000000010d84811d -[NSString substringFromIndex:] + 126
4 myapp 0x000000010d5e15f5 RCTBundlePathForURL + 293
5 myapp 0x000000010d5e167d RCTIsXCAssetURL + 45
6 myapp 0x000000010d6336d0 -[RCTXCAssetImageLoader canLoadImageURL:] + 48
7 myapp 0x000000010d62ac77 -[RCTImageLoader imageURLLoaderForURL:] + 615
8 myapp 0x000000010d62c070 __87-[RCTImageLoader loadImageWithTag:size:scale:resizeMode:progressBlock:completionBlock:]_block_invoke_2125 + 368
9 libdispatch.dylib 0x000000011201fe5d _dispatch_call_block_and_release + 12
10 libdispatch.dylib 0x000000011204049b _dispatch_client_callout + 8
11 libdispatch.dylib 0x00000001120268ec _dispatch_queue_drain + 2215
12 libdispatch.dylib 0x0000000112025e0d _dispatch_queue_invoke + 601
13 libdispatch.dylib 0x0000000112028a56 _dispatch_root_queue_drain + 1420
14 libdispatch.dylib 0x00000001120284c5 _dispatch_worker_thread3 + 111
15 libsystem_pthread.dylib 0x000000011237868f _pthread_wqthread + 1129
16 libsystem_pthread.dylib 0x0000000112376365 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
original code here
https://gist.github.com/AhmedMAtia/141208f80e28a4343e26
I've had trouble upgrading from 0.13 as well. I solved this by creating a new project, then moving my custom app code over.
I have this particular segue that keeps giving me NSRangeException. I have no code at all in prepareForSegue. I put a break point in viewdidload of that view controller and it is executed with no problem. Seems that the exception occurs in IOS system code.
This is detail of exception
2015-09-16 07:21:24.939 Vote Strategic[7523:1117149] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a699c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c204bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010a583093 -[__NSArrayM objectAtIndex:] + 227
3 My Strategic 0x000000010a008cfa _TPAo13 + 42
4 My Strategic 0x000000010a009c35 _TTRXFo_dSi_aPSs9AnyObject__XFo_dSi_oPS_ + 21
5 My Strategic 0x000000010a0094ec _TFFC14My_Strategic4Rest9getRidingFS0_FSST_U_FTGSQCSo13NSURLResponse_GSQCSo6NSData_GSQCSo7NSError__T_ + 1260
6 My Strategic 0x000000010a009cea _TTRXFo_oGSQCSo13NSURLResponse_oGSQCSo6NSData_oGSQCSo7NSError__dT__XFdCb_dGSQS__dGSQS0__dGSQS1___dT__ + 90
7 CFNetwork 0x000000010c8a98c5 67+[NSURLConnection sendAsynchronousRequest:queue:completionHandler:]_block_invoke_2 + 155
8 Foundation 0x000000010ab5a57f __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7
9 Foundation 0x000000010aa9b0b2 -[NSBlockOperation main] + 98
10 Foundation 0x000000010aa7d774 -[__NSOperationInternal _start:] + 645
11 Foundation 0x000000010aa7d383 __NSOQSchedule_f + 184
12 libdispatch.dylib 0x000000010dcfe614 _dispatch_client_callout + 8
13 libdispatch.dylib 0x000000010dce56a7 _dispatch_queue_drain + 2176
14 libdispatch.dylib 0x000000010dce4cc0 _dispatch_queue_invoke + 235
15 libdispatch.dylib 0x000000010dce83b9 _dispatch_root_queue_drain + 1359
16 libdispatch.dylib 0x000000010dce9b17 _dispatch_worker_thread3 + 111
17 libsystem_pthread.dylib 0x000000010e06b637 _pthread_wqthread + 729
18 libsystem_pthread.dylib 0x000000010e06940d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Please put exception breakpoint and run in debug mode to stop at the exact line of crash.
Clearly you are trying to access objects from an empty array which is bound to crash. It is always advisable to put a check on array size before accessing its elements.
I'm using Local Notification plugin for a phonegap iOS app. When I try to add a new Notification, the app throw a NSInvalidArgumentException.
Here is the code when i add a notification:
var now = new Date().getTime(),
_60_seconds_from_now = new Date(now + 60*1000);
window.plugin.notification.local.add({
id: 1,
title: 'Reminder',
message: 'Dont forget to buy some flowers.',
repeat: false,
date: _60_seconds_from_now
});
And here is the output
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0xa26c650'
*** First throw call stack:
(
0 CoreFoundation 0x000dd1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x021948e5 objc_exception_throw + 44
2 CoreFoundation 0x0017a243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x000cd50b ___forwarding___ + 1019
4 CoreFoundation 0x000cd0ee _CF_forwarding_prep_0 + 14
5 OPS 0x000276e9 -[APPLocalNotification notificationWithId:] + 521
6 OPS 0x00027246 -[APPLocalNotification isNotificationScheduledWithId:] + 86
7 OPS 0x00023458 __28-[APPLocalNotification add:]_block_invoke + 200
8 libdispatch.dylib 0x027527b8 _dispatch_call_block_and_release + 15
9 libdispatch.dylib 0x027674d0 _dispatch_client_callout + 14
10 libdispatch.dylib 0x02755eb7 _dispatch_root_queue_drain + 291
11 libdispatch.dylib 0x02756127 _dispatch_worker_thread2 + 39
12 libsystem_pthread.dylib 0x02a96dab _pthread_wqthread + 336
13 libsystem_pthread.dylib 0x02a9acce start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
any idea? Thank you.
Your id param is not string, but the plugin seem to require a string value for id.
I find the solution. If you are using iOS 7.1, you must replace this line
NSString* notId =[notification.userInfo objectForKey:#"id"];
for this
NSString* notId =[NSString stringWithFormat:#"%#", [notification.userInfo objectForKey:#"id"]];
in the method notificationWithId.
Thanks for the help!