CoreFoundation __exceptionPreprocess crash - ios

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

Related

App Crash Immediately after initiating Quickblox video call from web to iOS app

I have try to video call using QuickBlox from web page to iOS app but when I am call from web immediately iOS app crash with as below log.
[3553:77957] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString count]: unrecognized selector sent to instance 0x10e546c78'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 libswiftFoundation.dylib 0x000000010f8849f5 $sSD10FoundationE26_forceBridgeFromObjectiveC_6resultySo12NSDictionaryC_SDyxq_GSgztFZ + 709
6 libswiftFoundation.dylib 0x000000010f8789e3 $sSD10FoundationE36_unconditionallyBridgeFromObjectiveCySDyxq_GSo12NSDictionaryCSgFZ + 67
7 ProjectDemo 0x000000010d71912a $s15ProjectDemo6HomeVCC20didReceiveNewSession_8userInfoySo12QBRTCSessionC_SDyS2SGSgtFTo + 138
8 CoreFoundation 0x00007fff23c7820c __invoking___ + 140
9 CoreFoundation 0x00007fff23c753af -[NSInvocation invoke] + 319
10 CoreFoundation 0x00007fff23c75684 -[NSInvocation invokeWithTarget:] + 68
11 Quickblox 0x000000010e4cb67e qb_jid + 89448
12 libdispatch.dylib 0x000000010fb97dd4 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x000000010fb98d48 _dispatch_client_callout + 8
14 libdispatch.dylib 0x000000010fba6de6 _dispatch_main_queue_callback_4CF + 1500
15 CoreFoundation 0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
16 CoreFoundation 0x00007fff23bceca9 __CFRunLoopRun + 2329
17 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
18 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
19 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
20 ProjectDemo 0x000000010d75a98b main + 75
21 libdyld.dylib 0x00007fff5227ec25 start + 1
22 ??? 0x0000000000000001 0x0 + 1
)
2020-09-01 09:56:40:474 ProjectDemo[3553:1260b] SEND: <a xmlns="urn:xmpp:sm:3" h="2"/>
libc++abi.dylib: terminating with uncaught exception of type NSException
Most likely, the issue is related to outdated Javascript SDK.
Per our check, your Javascript SDK version is 2.8.1. Please update SDK to the latest version 2.12.9: https://github.com/QuickBlox/quickblox-javascript-sdk
Also, make sure that you are using the latest iOS SDK version 2.17.4: https://github.com/QuickBlox/quickblox-ios-sdk

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

How to fix crash 'Fatal Exception: NSInvalidArgumentException'

I'm facing a crash. There's no accurate code show me which line crashed.
I have used a webview in my app. But i'm not sure why it crash.
0 CoreFoundation __exceptionPreprocess
1 libobjc.A.dylib objc_exception_throw
2 CoreFoundation _CFArgv
3 CoreFoundation -[__NSPlaceholderSet initWithObjects:count:]
4 CoreFoundation -[__NSSetM copyWithZone:]
5 UIKitCore -[UIView _dispatchTintColorVisitorWithReasons:]
6 UIKitCore -[UIView setTintAdjustmentMode:]
7 UIKitCore -[_UIButtonBarButtonVisualProviderIOS updateButton:forEnabledState:]
8 UIKitCore -[_UIButtonBarButton setEnabled:]
9 UIKitCore -[UIPrintPanelTableViewController setShowContactingPrinter:]
10 libdispatch.dylib _dispatch_call_block_and_release
11 libdispatch.dylib _dispatch_client_callout
12 libdispatch.dylib _dispatch_main_queue_callback_4CF$VARIANT$mp
13 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
14 CoreFoundation
__CFRunLoopRun
15 CoreFoundation CFRunLoopRunSpecific
16 GraphicsServices GSEventRunModal
17 UIKitCore UIApplicationMain
18 ChopeDashboard main.m line 14 main + 14
19 libdyld.dylib start
Is there some faced the same problem, and how to fix it?

Unknown Error: Not reproducible Fatal Exception

My app is experiencing a weird error which I cannot reproduce. I know the existence of this error because some users have reported it to me and I could catch it using the Fabric SDK.
Apparently it happens at any location, at any given time. It doesn't not happen a lot though, it seems to happen once in a while. I have no idea where to start looking for this, because I tried to catch the error running on multiple devices connected to my xcode project, but it just doesn't happen to me, or at least when I am looking for it. Can someone give me a light where to begin to look for it?
The stack trace:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x18730afe0 __exceptionPreprocess
1 libobjc.A.dylib 0x185d6c538 objc_exception_throw
2 CoreFoundation 0x187311ef4 __methodDescriptionForSelector
3 CoreFoundation 0x18730ef54 ___forwarding___
4 CoreFoundation 0x18720ad4c _CF_forwarding_prep_0
5 Foundation 0x187dff50c __NSThreadPerformPerform
6 CoreFoundation 0x1872b942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
7 CoreFoundation 0x1872b8d04 __CFRunLoopDoSources0
8 CoreFoundation 0x1872b69a8 __CFRunLoopRun
9 CoreFoundation 0x1871e6da4 CFRunLoopRunSpecific
10 GraphicsServices 0x188c51074 GSEventRunModal
11 UIKit 0x18d49ac9c UIApplicationMain
12 Otelo 0x100230fc4 main (AppDelegate.swift:23)
13 libdyld.dylib 0x1861f559c start
Crashed: com.twitter.crashlytics.ios.exception
0 Otelo 0x1005bb308 CLSProcessRecordAllThreads + 1572
1 Otelo 0x1005bb308 CLSProcessRecordAllThreads + 1572
2 Otelo 0x1005bb1c4 CLSProcessRecordAllThreads + 1248
3 Otelo 0x1005aaa6c CLSHandler + 48
4 Otelo 0x1005b9110 __CLSExceptionRecord_block_invoke + 92
5 libdispatch.dylib 0x1861c29a0 _dispatch_client_callout + 16
6 libdispatch.dylib 0x1861cfee0 _dispatch_barrier_sync_f_invoke + 84
7 Otelo 0x1005b8ba4 CLSExceptionRecord + 212
8 Otelo 0x1005b89cc CLSExceptionRecordNSException + 548
9 Otelo 0x1005b85e0 CLSTerminateHandler() + 396
10 libc++abi.dylib 0x185d5b5d4 std::__terminate(void (*)()) + 16
11 libc++abi.dylib 0x185d5b1a8 __cxa_rethrow + 144
12 libobjc.A.dylib 0x185d6c6f8 objc_exception_rethrow + 44
13 CoreFoundation 0x1871e6e10 CFRunLoopRunSpecific + 532
14 GraphicsServices 0x188c51074 GSEventRunModal + 100
15 UIKit 0x18d49ac9c UIApplicationMain + 208
16 Otelo 0x100230fc4 main (AppDelegate.swift:23)
17 libdyld.dylib 0x1861f559c start + 4

Restkit / CoreData __NSCFBoolean length unrecognized selector sent to instance

I am trying to debug this crash. It seems to be inside Apple's framework in description method but I don't know what it's causing it.
I'm using Restkit and Core Data. I get the crash as soon as the API returns a new model "Category" with array "products" empty.
Thank you
RRCategory + RRProduct models
https://gist.github.com/imton/6f7ff91bc3f3ac25a490
Mappings
https://gist.github.com/imton/33236e0ddefef0d50a35
https://gist.github.com/imton/9baa6a35a4a8f71aa440
Api Json https://gist.github.com/imton/118736e59c1a1092dc1b
{
"categories": [
{
"token": "6G1RKVMcfNdcbAX",
"title": "Cat3",
"picture_token": "ASDFASDF",
"products": []
}
]
}
Backstack
2014-12-07 10:55:30.838 Riderr[91164:34420246] -[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970
2014-12-07 10:55:30.862 Riderr[91164:34420246] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean length]: unrecognized selector sent to instance 0x10375c970'
*** First throw call stack:
(
0 CoreFoundation 0x00000001034b1b75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010314abb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001034b8c8d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001034106fc ___forwarding___ + 988
4 CoreFoundation 0x0000000103410298 _CF_forwarding_prep_0 + 120
5 CoreData 0x0000000100d3135c -[NSManagedObject _descriptionValues] + 620
6 CoreData 0x0000000100d3195b -[NSManagedObject description] + 267
7 Riderr 0x000000010037393b -[NSManagedObject(FixCrashBug) description_swizzle] + 43
8 CoreFoundation 0x00000001034a3ea6 -[NSArray descriptionWithLocale:indent:] + 358
9 Foundation 0x00000001014f3524 _NSDescriptionWithLocaleFunc + 64
10 CoreFoundation 0x00000001033ac97d __CFStringAppendFormatCore + 9645
11 CoreFoundation 0x00000001034922f0 _CFStringCreateWithFormatAndArgumentsAux2 + 256
12 Foundation 0x00000001014f34b8 -[NSPlaceholderString initWithFormat:locale:arguments:] + 153
13 Riderr 0x00000001003ad29c +[DDLog log:level:flag:context:file:function:line:tag:format:] + 588
14 Riderr 0x0000000100373b6d __21-[RRHomeTableVC sync]_block_invoke + 205
15 Riderr 0x00000001003770be __72-[RRRiderrClient getAllCategoriesWithProductsSuccessBlock:failureBlock:]_block_invoke + 142
16 Riderr 0x000000010051b92b __66-[RKObjectRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke244 + 91
17 libdispatch.dylib 0x00000001041b4b06 _dispatch_call_block_and_release + 12
18 libdispatch.dylib 0x00000001041d2794 _dispatch_client_callout + 8
19 libdispatch.dylib 0x00000001041bb89b _dispatch_main_queue_callback_4CF + 949
20 CoreFoundation 0x0000000103419469 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
21 CoreFoundation 0x00000001033dc36b __CFRunLoopRun + 2043
22 CoreFoundation 0x00000001033db906 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x00000001076de9f0 GSEventRunModal + 161
24 UIKit 0x0000000101e901a0 UIApplicationMain + 1282
25 Riderr 0x0000000100370fbc main + 140
26 libdyld.dylib 0x0000000104207145 start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
It means that you give an NSNumber-wrapped Boolean to CoreData when it expects a string.
Then apparently you use method swizzling which is a pretty bad idea and may lead to such crashes.

Resources