In one of my apps I have a very common crash.
I have this report in bugsense : *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
And this stack trace after symbolication:
0 CoreFoundation 0x3796b2a3 + 162
1 libobjc.A.dylib 0x3546b97f objc_exception_throw + 30
2 CoreFoundation 0x378b6b75 + 164
3 CoreData 0x357d9c93 + 1202
4 CoreData 0x357da863 + 1858
5 CoreFoundation 0x378bc037 _CFXNotificationPost + 1426
6 Foundation 0x39992d91 + 72
7 CoreData 0x35768307 + 78
8 CoreData 0x35767867 + 298
9 CoreData 0x356e9c0b + 2698
10 CoreData 0x356e910f + 270
11 CoreFoundation 0x379406cd + 20
12 CoreFoundation 0x3793e9c1 + 276
13 CoreFoundation 0x3793ed17 + 742
14 CoreFoundation 0x378b1ebd CFRunLoopRunSpecific + 356
15 CoreFoundation 0x378b1d49 CFRunLoopRunInMode + 104
16 GraphicsServices 0x355672eb GSEventRunModal + 74
17 UIKit 0x37329301 UIApplicationMain + 1120
18 HiBye 0x000c579d main + 244
19 libdyld.dylib 0x36207b20 + 0
I understand that the problem is in an empty NSMutableArray but I can not locate the place or at least a potential place in the code. I know that this trace does not say to much but I will appreciate any idea or direction that you can get from it that I might not be aware of.
Thanks
Shani
Related
Firebase Crashlytics shows a weird crash on iOS app, I can't understand what causing it:
Crashed: com.apple.main-thread
0 LogoQuizAC 0x10047f6a0 _hidden#18_ + 135 (__hidden#957_:135)
1 LogoQuizAC 0x1004771f4 _hidden#17_ + 96 (__hidden#454_:96)
2 LogoQuizAC 0x100477328 _hidden#20_ + 4304712488 (__hidden#456_:4304712488)
3 Foundation 0x19b094b20 __NSFireTimer + 68
4 CoreFoundation 0x199c79fa0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x199c79ba0 __CFRunLoopDoTimer + 1064
6 CoreFoundation 0x199c78ffc __CFRunLoopDoTimers + 328
7 CoreFoundation 0x199c72ee4 __CFRunLoopRun + 1936
8 CoreFoundation 0x199c7221c CFRunLoopRunSpecific + 600
9 GraphicsServices 0x1b183e784 GSEventRunModal + 164
10 UIKitCore 0x19c6b2ee8 -[UIApplication _run] + 1072
11 UIKitCore 0x19c6b875c UIApplicationMain + 168
12 LogoQuizAC 0x1002b503c main + 20 (RLockedCell.swift:20)
13 libdyld.dylib 0x1999326b0 start + 4
How can I figure it out? any strategy of solving this issue?
I have an property:
#property (nonatomic, retain) QBChatDialog* dialog;
When i make it nil in viewWillDisappear, it giving me error
- (void)viewWillDisappear:(BOOL)animated {
self.dialog = nil;
}
I am getting following error:
-[__NSArrayM removeObjectAtIndex:]: index 2147483647 beyond bounds for empty array'
even i don't use "removeObjectAtIndex". I think this is calling somewhere internally.
How to trace this.
my Complete Stack trace is:
(
0 CoreFoundation 0x05504494 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x05cd6e02 objc_exception_throw + 50
2 CoreFoundation 0x0540b2cd -[__NSArrayM removeObjectAtIndex:] + 445
3 Qboy 0x0026d23e -[TWMessageBarViewController statusBarHidden] + 43262
4 Qboy 0x002acffc QBAFQueryStringPairsFromKeyAndValue + 110104
5 libobjc.A.dylib 0x05cea060 _ZN11objc_object17sidetable_releaseEb + 238
6 libobjc.A.dylib 0x05ce9361 objc_release + 65
7 libobjc.A.dylib 0x05ce9318 objc_storeStrong + 39
8 Qboy 0x0007a35a -[ChatVC .cxx_destruct] + 298
9 libobjc.A.dylib 0x05cd58e2 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 116
10 libobjc.A.dylib 0x05cd5869 object_cxxDestruct + 20
11 libobjc.A.dylib 0x05cdfcb6 objc_destructInstance + 48
12 CoreFoundation 0x0550e57c -[NSObject(NSObject) __dealloc_zombie] + 156
13 UIKit 0x038de904 -[UIResponder dealloc] + 162
14 UIKit 0x03855e85 -[UIViewController dealloc] + 2296
15 Qboy 0x0017bf93 -[QMChatViewController dealloc] + 835
16 UIKit 0x040c1b75 -[UIViewController(UIKitManual) release] + 88
17 libobjc.A.dylib 0x05ce934f objc_release + 47
18 libobjc.A.dylib 0x05cea52d _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 371
19 CoreFoundation 0x053d48a8 _CFAutoreleasePoolPop + 24
20 CoreFoundation 0x0540c43c __CFRunLoopRun + 2364
21 CoreFoundation 0x0540b846 CFRunLoopRunSpecific + 470
22 CoreFoundation 0x0540b65b CFRunLoopRunInMode + 123
23 GraphicsServices 0x06eef664 GSEventRunModal + 192
24 GraphicsServices 0x06eef4a1 GSEventRun + 104
25 UIKit 0x03688eb9 UIApplicationMain + 160
26 Qboy 0x000db84a main + 138
27 libdyld.dylib 0x062cca25 start + 1
28 ??? 0x00000001 0x0 + 1
)
Please suggest me. What to do?
error tells you that
you have an array which is empty/nil
and after that you are removing an item of object which object is no longer exists in this array
Trick: for quick fix search 'removeObjectAtIndex' all overs the project(from upper left 3rd search button). if find one/lot observe those
You may not be calling removeObjectAtIndex: inside viewWillDisappear:, but you are calling it within -[TWMessageBarViewController statusBarHidden]. Look there and I think you'll find the source of your crash!
I'm trying to analyze a log for what appears to be an intermittent crash.
Here's the stack trace for the thread that throws the exception:
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x2ab5f49f __exceptionPreprocess + 126
1 libobjc.A.dylib 0x38315c8b objc_exception_throw + 38
2 CoreFoundation 0x2ab5f3e5 -[NSException initWithCoder:]
3 Foundation 0x2b862389 -[NSProxy doesNotRecognizeSelector:] + 68
4 CoreFoundation 0x2ab627d7 ___forwarding___ + 714
5 CoreFoundation 0x2aa94058 _CF_forwarding_prep_0 + 24
6 UIKit 0x292648cb -[UIScrollViewAccessibility _axCleanupDelegateClearer] + 98
7 UIKit 0x29264965 -[UIScrollViewAccessibility dealloc] + 60
8 UIKit 0x2e19c8b1 -[UITableView dealloc] + 1572
9 UIKit 0x2924dc91 -[UITableViewAccessibility dealloc] + 172
10 libobjc.A.dylib 0x38314da1 object_cxxDestructFromClass(objc_object*, objc_class*) + 116
11 libobjc.A.dylib 0x3831e5f7 objc_destructInstance + 34
12 libobjc.A.dylib 0x3831e61b object_dispose + 14
13 UIKit 0x2e3214d1 -[UIResponder dealloc] + 96
14 UIKit 0x2e18eb55 -[UIViewController dealloc] + 1760
15 CoreFoundation 0x2aa6600d CFRelease + 600
16 CoreFoundation 0x2aa7968f -[__NSArrayI dealloc] + 66
17 libobjc.A.dylib 0x3832fd5f objc_object::sidetable_release(bool) + 166
18 libobjc.A.dylib 0x383301a9 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 404
19 CoreFoundation 0x2aa71149 _CFAutoreleasePoolPop + 16
20 UIKit 0x2e01789f _wrapRunLoopWithAutoreleasePoolHandler + 42
21 CoreFoundation 0x2ab25d95 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
22 CoreFoundation 0x2ab23453 __CFRunLoopDoObservers + 278
23 CoreFoundation 0x2ab2385b __CFRunLoopRun + 914
24 CoreFoundation 0x2aa713c1 CFRunLoopRunSpecific + 476
25 CoreFoundation 0x2aa711d3 CFRunLoopRunInMode + 106
26 GraphicsServices 0x31e6f0a9 GSEventRunModal + 136
27 UIKit 0x2e080fa1 UIApplicationMain + 1440
28 MyApp 0x000938b1 main (main.mm:21)
29 libdyld.dylib 0x38895aaf start + 2
And here's the stack trace for the main thread:
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x3895bdfc __pthread_kill + 8
1 libsystem_pthread.dylib 0x389d9d37 pthread_kill + 62
2 libsystem_c.dylib 0x388fb909 abort + 76
3 libc++abi.dylib 0x37c399c9 __cxa_bad_cast
4 libc++abi.dylib 0x37c53671 default_unexpected_handler()
5 libobjc.A.dylib 0x38315f25 _objc_terminate() + 192
6 libc++abi.dylib 0x37c50de3 std::__terminate(void (*)()) + 78
7 libc++abi.dylib 0x37c508af __cxa_rethrow + 102
8 libobjc.A.dylib 0x38315dd3 objc_exception_rethrow + 42
9 CoreFoundation 0x2aa7145d CFRunLoopRunSpecific + 632
10 CoreFoundation 0x2aa711d3 CFRunLoopRunInMode + 106
11 GraphicsServices 0x31e6f0a9 GSEventRunModal + 136
12 UIKit 0x2e080fa1 UIApplicationMain + 1440
13 MyApp 0x000938b1 main (main.mm:21)
Looking through the trace with the exception, I see a CF_forwarding_prep_0 message, which is followed by an [NSProxy doesNotRecognizeSelector] exception. Reading that, is it a safe assumption that the cause of the issue is that there's a pointer to a tableview delegate that isn't being set to nil? That's about the only discernible thing I see here.
Any help would be most appreciated. Thanks!
I have a problem with core data that is crashing my app. This happens when i'm trying to add a object to a relationship.
HOMUser *artist = [HOMUser GetUserWithDictionary:artistDict inContext:context];
[self addMArtistsObject:artist];
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 25 beyond bounds [0 .. 24]'
The number 25 represents how many entities are in Core Data Model. This is the call stack. It goes far into the framework so i cannot debug a lot. This didn't happened since always. I've checked and rechecked the Core Data Model. Does anybody have a ideea about what can be wrong?
0 CoreFoundation 0x02c0e02e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x02a33e7e objc_exception_throw + 44
2 CoreFoundation 0x02bb00b4 -[__NSArrayM objectAtIndex:] + 196
3 CoreData 0x0122ee2a -[NSManagedObject(_NSInternalMethods) _includeObject:intoPropertyWithKey:andIndex:] + 90
4 CoreData 0x0122ed0e -[NSManagedObject(_NSInternalMethods) _maintainInverseRelationship:forProperty:oldDestination:newDestination:] + 590
5 CoreData 0x0122fcb1 -[NSManagedObject(_NSInternalMethods) _maintainInverseRelationship:forProperty:forChange:onSet:] + 273
6 CoreData 0x0122e956 -[NSManagedObject(_NSInternalMethods) _didChangeValue:forRelationship:named:withInverse:] + 1878
7 CoreData 0x0122e1f0 -[NSManagedObjectContext observeValueForKeyPath:ofObject:change:context:] + 400
8 Foundation 0x021a6ce7 NSKeyValueNotifyObserver + 357
9 Foundation 0x021c03f4 NSKeyValueDidChange + 456
10 Foundation 0x022239c3 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:withSetMutation:usingObjects:] + 131
11 CoreData 0x0122fb58 _PF_ManagedObject_DidChangeValueForKeywithSetMutation + 72
12 CoreData 0x012a77e6 _sharedIMPL_addObjectToSet_core + 310
13 ??? 0x0bcf1379 0x0 + 198120313
14 Product Name 0x000acb39 -[HOMEvent initWithTitle:withArtist:withPlace:withWhen:withDescription:andWithOptionsLink:andWithLinkWith:andWithFriends:insertIntoContext:] + 1161
15 Product Name 0x002315a3 -[HOMAddEventVCViewController postPressed:] + 8771
16 libobjc.A.dylib 0x02a47705 -[NSObject performSelector:withObject:withObject:] + 77
17 UIKit 0x016b7920 -[UIApplication sendAction:to:from:forEvent:] + 96
18 UIKit 0x016b78b8 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
19 UIKit 0x01778671 -[UIControl sendAction:to:forEvent:] + 66
20 UIKit 0x01778bcf -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578
21 UIKit 0x01777d38 -[UIControl touchesEnded:withEvent:] + 546
22 UIKit 0x0197b213 _UIGestureRecognizerUpdate + 7407
23 CoreFoundation 0x02bd6afe __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
24 CoreFoundation 0x02bd6a3d __CFRunLoopDoObservers + 381
25 CoreFoundation 0x02bb47c2 __CFRunLoopRun + 1106
26 CoreFoundation 0x02bb3f44 CFRunLoopRunSpecific + 276
27 CoreFoundation 0x02bb3e1b CFRunLoopRunInMode + 123
28 GraphicsServices 0x038247e3 GSEventRunModal + 88
29 GraphicsServices 0x03824668 GSEventRun + 104
30 UIKit 0x016b465c UIApplicationMain + 1211
I attempt to access a float value of a NSManagedObject using
float f = [managedObject.price floatValue];
and get the following error. I thought this error was caused when an object was deleted and you try to manipulate it. I do not update nor delete any properties of the original object. Is there any other reason this error would occur?
2011-07-29 13:02:54.797 AEsir[3760:707] *** Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x6095d20 <x-coredata://6483BA33-F9AD-436C-91CB-0EE6E07F2FBE/Venue/p7>''
*** Call stack at first throw:
(
0 CoreFoundation 0x35c6464f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x31cb9c5d objc_exception_throw + 24
2 CoreData 0x30a51e99 _PFFaultHandlerLookupRow + 1244
3 CoreData 0x30aa69c1 -[NSFaultHandler fulfillFault:withContext:] + 20
4 CoreData 0x30aa5789 _PF_FulfillDeferredFault + 360
5 CoreData 0x30a50f1f _sharedIMPL_pvfk_core + 58
6 CoreData 0x30ab481b _pvfk_16 + 10
7 AEsir 0x0000b641 -[VenueListViewController transactionSucceeded:] + 240
8 Foundation 0x35f31183 _nsnote_callback + 142
9 CoreFoundation 0x35c3320f __CFXNotificationPost_old + 402
10 CoreFoundation 0x35bcdeeb _CFXNotificationPostNotification + 118
11 Foundation 0x35f2e5d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
12 AEsir 0x00036c67 -[CreditManager finishTransaction:wasSuccessful:] + 170
13 AEsir 0x00036d4b -[CreditManager completeTransaction:] + 106
14 AEsir 0x00036ffb -[CreditManager paymentQueue:updatedTransactions:] + 246
15 StoreKit 0x35970da9 __NotifyObserverAboutChanges + 44
16 CoreFoundation 0x35bcc3c5 CFArrayApplyFunction + 40
17 StoreKit 0x359727f1 -[SKPaymentQueue _notifyObserversAboutChanges:] + 92
18 StoreKit 0x35972351 -[SKPaymentQueue _processUpdates:trimUnmatched:] + 860
19 StoreKit 0x35971137 -[SKPaymentQueue _transactionUpdatedNotification:] + 98
20 Foundation 0x35f31183 _nsnote_callback + 142
21 CoreFoundation 0x35c3320f __CFXNotificationPost_old + 402
22 CoreFoundation 0x35bcdeeb _CFXNotificationPostNotification + 118
23 Foundation 0x35f2e5d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
24 AppSupport 0x35272455 -[CPDistributedNotificationCenter deliverNotification:userInfo:] + 44
25 AppSupport 0x35273781 _CPDNDeliverNotification + 204
26 AppSupport 0x352721d7 _XDeliverNotification + 122
27 AppSupport 0x35268dd7 migHelperRecievePortCallout + 138
28 CoreFoundation 0x35c3ba97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
29 CoreFoundation 0x35c3d83f __CFRunLoopDoSource1 + 166
30 CoreFoundation 0x35c3e60d __CFRunLoopRun + 520
31 CoreFoundation 0x35bceec3 CFRunLoopRunSpecific + 230
32 CoreFoundation 0x35bcedcb CFRunLoopRunInMode + 58
33 GraphicsServices 0x30b5d41f GSEventRunModal + 114
34 GraphicsServices 0x30b5d4cb GSEventRun + 62
35 UIKit 0x30dd9d69 -[UIApplication _run] + 404
36 UIKit 0x30dd7807 UIApplicationMain + 670
37 AEsir 0x00008093 main + 70
38 AEsir 0x00002d8c start + 52
)
You can get the error if something happens with the persistent store e.g. you remove the store from the persistent store manager used by the context.
Most likely, however, the managed object has been deleted but you have retained a reference to it elsewhere.