NSRangeException at particular Segue - ios

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.

Related

Core Data - Crash while listening for notification NSManagedObjectContextDidSave

Seeing a strange crash while listening
NotificationCenter.default.addObserver(self, selector: #selector(contextDidSave(_:)), name: .NSManagedObjectContextDidSave, object: nil)
#objc private func contextDidSave(_ notification: Notification) {
print(notification)
}
However, keeping below line and calling something else inside it not causing any issues.
Below code will work fine as we are not printing or consuming objects
if let updatedObjects = notification.userInfo?[NSUpdatedObjectsKey] as? Set<User>, !updatedObjects.isEmpty {
myMethod()
}
Already debugged by using NSZombiesEnabled, InstrumentsWithCoreData, Exception Breakpoints,ThreadSanatizer, "Arguments Passed on Launch" in -com.apple.CoreData.ConcurrencyDebug 1
Unable to get why it's happening. However i thought it's of property so I printed all property 1 by 1 it worked fine for me.
As per as my knowledge it's happening because of combination of Swift and Obj-C
It's a huge project so I am not sure what can be done?
Is there a way that I can get more info about object via it's reference mat be object name or another information, Somehow?
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean objectID]: unrecognized selector sent to instance 0x7fff80634470'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3de6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff512539b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e5eb94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23e4286c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23e44b58 _CF_forwarding_prep_0 + 120
5 CoreData 0x00007fff23a816c9 -[NSManagedObject _descriptionValues] + 1566
6 CoreData 0x00007fff23a819f1 -[NSManagedObject description] + 261
7 CoreFoundation 0x00007fff23e60600 -[NSSet descriptionWithLocale:indent:] + 416
8 CoreFoundation 0x00007fff23e37858 -[NSDictionary descriptionWithLocale:indent:] + 1416
9 Foundation 0x00007fff259698c9 _NSDescriptionWithLocaleFunc + 55
10 CoreFoundation 0x00007fff23dc7281 __CFStringAppendFormatCore + 12737
11 CoreFoundation 0x00007fff23dc8ea5 _CFStringCreateWithFormatAndArgumentsAux2 + 133
12 CoreData 0x00007fff23a324a4 _NSCoreDataLog + 248
13 CoreData 0x00007fff239f7e80 -[NSManagedObjectContext(_NSInternalAdditions) _didSaveChanges] + 2893
14 CoreData 0x00007fff239ee7d6 -[NSManagedObjectContext save:] + 4166
15 *********** 0x00000001076e8db3 __31-[MyStorageManager saveContext]_block_invoke + 83
16 CoreData 0x00007fff23a0338d developerSubmittedBlockToNSManagedObjectContextPerform + 154
17 libdispatch.dylib 0x000000010f252e8e _dispatch_client_callout + 8
18 libdispatch.dylib 0x000000010f260d97 _dispatch_main_queue_callback_4CF + 1149
19 CoreFoundation 0x00007fff23da1869 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
20 CoreFoundation 0x00007fff23d9c3b9 __CFRunLoopRun + 2041
21 CoreFoundation 0x00007fff23d9b8a4 CFRunLoopRunSpecific + 404
22 GraphicsServices 0x00007fff38c39bbe GSEventRunModal + 139
23 UIKitCore 0x00007fff49325968 UIApplicationMain + 1605
24 *********** 0x00000001074dc882 main + 146
25 libdyld.dylib 0x00007fff520ce1fd start + 1
26 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

iOS/Swift :: HERE Maps sporadicly crashing during init => [NSCFString hac_toVariant]

i'm currently facing an issue in two different projects using HEREMaps. Right after initializing via NMAApplicationContext.set(...) the app is crashing giving the following log:
2017-05-02 10:15:25.372 ANIO[3574:431630] -[NSCFString hac_toVariant]: unrecognized selector sent to instance 0x618000027560
2017-05-02 10:15:25.403 ANIO[3574:431630] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString hac_toVariant]: unrecognized selector sent to instance 0x618000027560'
*** First throw call stack:
(
0 CoreFoundation 0x000000010edccb0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010e41c141 objc_exception_throw + 48
2 CoreFoundation 0x000000010ee3c134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010ed53840 ___forwarding_ + 1024
4 CoreFoundation 0x000000010ed533b8 _CF_forwarding_prep_0 + 120
5 ANIO 0x000000010d67819a _Z29PathToFileInWritableDirectoryP8NSString + 19706
6 ANIO 0x000000010d6bd98c _ZN6smart518segments_intersectExxxxxxxxPxS0_ + 55445
7 ANIO 0x000000010d6cdd8a _ZNSt3__110__list_impIN6smart517OrientedPointPairINS1_7geopt_tEEENS_9allocatorIS4_EEE5clearEv + 13288
8 ANIO 0x000000010d6cd1bb _ZNSt3__110__list_impIN6smart517OrientedPointPairINS1_7geopt_tEEENS_9allocatorIS4_EEE5clearEv + 10265
9 ANIO 0x000000010d6ee8a9 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97469
10 ANIO 0x000000010d6ee778 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97164
11 ANIO 0x000000010d6ee93e _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97618
12 ANIO 0x000000010d6ef293 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 100007
13 ANIO 0x000000010d6ecebc _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 90832
14 libdispatch.dylib 0x00000001122c44a6 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x00000001122ed05c _dispatch_client_callout + 8
16 libdispatch.dylib 0x00000001122cb94f _dispatch_queue_serial_drain + 221
17 libdispatch.dylib 0x00000001122cc669 _dispatch_queue_invoke + 1084
18 libdispatch.dylib 0x00000001122ceec4 _dispatch_root_queue_drain + 634
19 libdispatch.dylib 0x00000001122cebef _dispatch_worker_thread3 + 123
20 libsystem_pthread.dylib 0x0000000112684746 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x0000000112684221 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
anyone facing the same problems? any idea?
the only way to get rid of this error is de-/installing the app.
Kind regards,
Michael
OK, short update... the bug is easily reproducible.
1.)Download sample code from [link]https://developer.here.com/mobile-sdks/documentation/ios-starter/topics/quick-start.html
2.)Follow steps to include NMAKit-framework & NMAKit-bundle
3.)Build and run (Xcode Version 8.3.2 (8E2002)). Target simulator/hardware doesn't matter (tried iPhone 6/7/s simulator and hardware). Even using Obj-c or Swift sample makes no difference at all.
On first start everything's fine. Second start leads to crash.
2017-05-02 13:38:34.331 HelloMap[16821:1642096] -[NSCFString hac_toVariant]: unrecognized selector sent to instance 0x7f80266079a0
2017-05-02 13:38:34.342 HelloMap[16821:1642096] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString hac_toVariant]: unrecognized selector sent to instance 0x7f80266079a0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d9d9d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d44ddeb objc_exception_throw + 48
2 CoreFoundation 0x000000010d9e2d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010d928cfa ___forwarding_ + 970
4 CoreFoundation 0x000000010d9288a8 _CF_forwarding_prep_0 + 120
5 HelloMap 0x000000010cb6e9de _Z29PathToFileInWritableDirectoryP8NSString + 19706
6 HelloMap 0x000000010cbb41cc _ZN6smart518segments_intersectExxxxxxxxPxS0_ + 55445
7 HelloMap 0x000000010cbc4534 _ZNSt3__110__list_impIN6smart517OrientedPointPairINS1_7geopt_tEEENS_9allocatorIS4_EEE5clearEv + 13288
8 HelloMap 0x000000010cbc3965 _ZNSt3__110__list_impIN6smart517OrientedPointPairINS1_7geopt_tEEENS_9allocatorIS4_EEE5clearEv + 10265
9 HelloMap 0x000000010cbe5009 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97469
10 HelloMap 0x000000010cbe4ed8 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97164
11 HelloMap 0x000000010cbe509e _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 97618
12 HelloMap 0x000000010cbe59f3 _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 100007
13 HelloMap 0x000000010cbe361c _ZNSt3__16vectorI11_GLKVector2NS_9allocatorIS1_EEE26__swap_out_circular_bufferERNS_14__split_bufferIS1_RS3_EE + 90832
14 libdispatch.dylib 0x000000010fe90d9d _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x000000010feb13eb _dispatch_client_callout + 8
16 libdispatch.dylib 0x000000010fe9782c _dispatch_queue_drain + 2215
17 libdispatch.dylib 0x000000010fe96d4d _dispatch_queue_invoke + 601
18 libdispatch.dylib 0x000000010fe99996 _dispatch_root_queue_drain + 1420
19 libdispatch.dylib 0x000000010fe99405 _dispatch_worker_thread3 + 111
20 libsystem_pthread.dylib 0x00000001101ee746 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x00000001101ee221 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Thanks for reporting this, this is caused by us using Objective-C Categories in the HERE SDK and shipping it as a static library. One thing you can do is add the -ObjC linker flag to your build (OTHER_LDFLAGS) to get around this.
More info here: Categories In Static Libraries
This will be fixed in a future release.

react native terminating with uncaught exception of type NSException

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.

CoreFoundation __exceptionPreprocess crash

I am getting a Fatal Exception: NSRangeException
*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
But there is no call to removeObjectAtIndex, and this happens in different view controllers. I am just looking for ideas as to where to look since in lines 3-5 the App is given control but there are no symbols.
The crash log is from fabric/crashlytics and it only occurred around ~30 days from app release but the instance or number of crashes is relevant.
Thread : Fatal Exception: NSRangeException
0 CoreFoundation 0x00000001830502d8 __exceptionPreprocess + 132
1 libobjc.A.dylib 0x00000001948740e4 objc_exception_throw + 60
2 CoreFoundation 0x0000000182f3385c -[__NSArrayM removeObjectAtIndex:]
3 AppName 0x00000001000875b8
4 AppName 0x000000010008698c
5 AppName 0x00000001000867c4
6 libdispatch.dylib 0x0000000194ec5994 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x0000000194ec5954 _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000194eca20c _dispatch_main_queue_callback_4CF + 1608
9 CoreFoundation 0x00000001830077f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
10 CoreFoundation 0x00000001830058a0 __CFRunLoopRun + 1492
11 CoreFoundation 0x0000000182f312d4 CFRunLoopRunSpecific + 396
12 GraphicsServices 0x000000018c7476fc GSEventRunModal + 168
13 UIKit 0x0000000187af6fac UIApplicationMain + 1488
14 AppName 0x000000010012e8cc
15 libdyld.dylib 0x0000000194ef2a08 start + 4

SimpleLogin facebook wont login

i'm using the firebase simpleLogin for facebook login, but there seem to be an issue. i'm not sure how to debug this. What seem to be the issue here?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x02c331e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x029b28e5 objc_exception_throw + 44
2 CoreFoundation 0x02bf9376 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390
3 CoreFoundation 0x02c26c29 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 73
4 app 0x000257b5 ParseUserData + 373
5 app 0x000982a6 __38-[LoginViewController actionFacebook:]_block_invoke + 358
6 app 0x00148647 __89-[FirebaseSimpleLogin loginToFacebookAppWithId:permissions:audience:withCompletionBlock:]_block_invoke245 + 83
7 app 0x00149068 __86-[FirebaseSimpleLogin requestFacebookAccountWithPermissions:audience:appId:withBlock:]_block_invoke + 245
8 Accounts 0x012cc91f __69-[ACAccountStore requestAccessToAccountsWithType:options:completion:]_block_invoke_2 + 85
9 libdispatch.dylib 0x02f917b8 _dispatch_call_block_and_release + 15
10 libdispatch.dylib 0x02fa64d0 _dispatch_client_callout + 14
11 libdispatch.dylib 0x02f92fe0 _dispatch_async_redirect_invoke + 202
12 libdispatch.dylib 0x02fa64d0 _dispatch_client_callout + 14
13 libdispatch.dylib 0x02f94eb7 _dispatch_root_queue_drain + 291
14 libdispatch.dylib 0x02f95127 _dispatch_worker_thread2 + 39
15 libsystem_pthread.dylib 0x032d5dab _pthread_wqthread + 336
16 libsystem_pthread.dylib 0x032d9cce start_wqthread + 30
)

Resources