How to Resolve "RemoveObjectAtIndex" - ios

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!

Related

when __NSDictionaryM dealloc crash

For a crash in my application, NSDictionary is an attribute of the model, and when the model executes the cxx_destruct function, crash occurs inside the NSDictionary.There's a place in the crash stack that I'm not sure about cow_cleanup, what's going on in this function?
And The reason for the crash is that during the model release process, NSDictionary changed, right?
Here is the concrete Crash stack
Thread 0 Crashed:
0 libobjc.A.dylib objc_release + 16
1 CoreFoundation cow_cleanup + 168
2 CoreFoundation -[__NSDictionaryM dealloc] + 144
3 imeituan -[CKContent .cxx_destruct] (CKContent.m:12)
4 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 112
5 libobjc.A.dylib objc_destructInstance + 88
6 libobjc.A.dylib _objc_rootDealloc + 52
7 imeituan -[CKTableViewCell .cxx_destruct] (CKTableViewCell.m:44)
8 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 112
9 libobjc.A.dylib objc_destructInstance + 88
10 libobjc.A.dylib _objc_rootDealloc + 52
11 UIKitCore -[UIResponder dealloc] + 152
12 UIKitCore -[UIView dealloc] + 872
13 UIKitCore -[UITableViewCell dealloc] + 236
14 imeituan -[CKBubbleCell dealloc (CKBubbleCell.m:222)
15 CoreFoundation -[__NSArrayM dealloc] + 228
16 UIKitCore -[UITableView .cxx_destruct] + 1524
17 libobjc.A.dylib object_cxxDestructFromClass(objc_object*, objc_class*) + 112
18 libobjc.A.dylib objc_destructInstance + 88
19 libobjc.A.dylib _objc_rootDealloc + 52
20 UIKitCore -[UIResponder dealloc] + 152
21 UIKitCore -[UIView dealloc] + 872
22 UIKitCore -[UIScrollView dealloc] + 852
23 UIKitCore -[UITableView dealloc] + 364
24 UIKitCore __destroy_helper_block_e8_32s40s + 24
25 libsystem_blocks.dylib _Block_release + 148
26 Foundation -[_NSTimerBlockTarget dealloc] + 44
27 Foundation _timerRelease + 64
28 CoreFoundation __CFRunLoopDoTimer + 936
29 CoreFoundation __CFRunLoopDoTimers + 276
30 CoreFoundation __CFRunLoopRun + 1640
31 CoreFoundation CFRunLoopRunSpecific + 424
32 GraphicsServices GSEventRunModal + 160
33 UIKitCore UIApplicationMain + 1932
34 imeituan main (main.m:38)
35 libdyld.dylib start + 4
Crashes like this are really tricky. The key to keep in mind is that you are crashing during a deallocation. And, more specifically, the crashing function is objc_release. To me, this strongly indicates that you've got an over-released object. It's looks to me like one of your model objects may have already been freed by this point. The issue isn't with the dictionary, directly.
I'd recommend using NSZombies, or one of the other memory allocation tools within Instruments to try to track down where your memory-management issue is.

iOS: Bad access is cxx_descruct

I have a problem with an app crashing for a few users, I have no idea whats causing it and all I got is this stacktrace from crashlytics:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x0000000194e5016c objc_release + 12
1 learnchinese 0x00000001000a95a0 -[WGRLanguageLabel .cxx_destruct] (WGRLanguageLabel.m:34)
2 libobjc.A.dylib 0x0000000194e36b1c object_cxxDestructFromClass(objc_object*, objc_class*) + 148
3 libobjc.A.dylib 0x0000000194e43f38 objc_destructInstance + 92
4 libobjc.A.dylib 0x0000000194e43f90 object_dispose + 28
5 UIKit 0x0000000187f8771c -[UIResponder dealloc] + 116
6 UIKit 0x0000000187c3dc38 -[UIView dealloc] + 1000
7 learnchinese 0x00000001000a5460 -[WGRLanguageLabel dealloc] (WGRLanguageLabel.m:39)
8 CoreFoundation 0x00000001830a10f8 CFRelease + 524
9 CoreFoundation 0x00000001830ad6b8 -[__NSArrayM dealloc] + 152
10 libobjc.A.dylib 0x0000000194e51724 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
11 CoreFoundation 0x00000001830a4d14 _CFAutoreleasePoolPop + 28
12 UIKit 0x0000000187c34584 _wrapRunLoopWithAutoreleasePoolHandler + 76
13 CoreFoundation 0x000000018317bff0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
14 CoreFoundation 0x0000000183178f7c __CFRunLoopDoObservers + 360
15 CoreFoundation 0x000000018317935c __CFRunLoopRun + 836
16 CoreFoundation 0x00000001830a4f74 CFRunLoopRunSpecific + 396
17 GraphicsServices 0x000000018cb076fc GSEventRunModal + 168
18 UIKit 0x0000000187ca6d94 UIApplicationMain + 1488
19 learnchinese 0x00000001001679ec main (main.m:13)
20 libdyld.dylib 0x00000001954e2a08 start + 4
It looks like WGRLanguageLabel has been released when auto release pool try to release it again.
Here is the dealloc method in WGRLanguageLabel:
#implementation WGRLanguageLabel
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
...
#end

Odd CF_forwarding_prep_0 crash - possible UITableView delegate issue?

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!

Parsing stack-trace of a crash

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

Application received signal SIGSEGV (IOS5)

it shows error log as below, who can tell me how could I find the code where induce this crash? thanks.
my device is iphone IOS 5.0,thanks very much.
(null)
(
0 CoreFoundation 0x353aa8a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x37751259 objc_exception_throw + 32
2 CoreFoundation 0x353aa789 +[NSException raise:format:] + 0
3 CoreFoundation 0x353aa7ab +[NSException raise:format:] + 34
4 MMBang 0x0018ccd9 MMBang + 1621209
5 libsystem_c.dylib 0x327b67e3 _sigtramp + 38
6 MMBang 0x000e9bc1 MMBang + 953281
7 CoreFoundation 0x353043fd -[NSObject performSelector:withObject:withObject:] + 52
8 MMBang 0x00094ed5 MMBang + 605909
9 CoreFoundation 0x353043fd -[NSObject performSelector:withObject:withObject:] + 52
10 MMBang 0x00093e6d MMBang + 601709
11 MMBang 0x00122ed3 MMBang + 1187539
12 CoreFoundation 0x353091fb -[NSObject performSelector:withObject:] + 42
13 Foundation 0x34ecd747 __NSThreadPerformPerform + 350
14 CoreFoundation 0x3537ead3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
15 CoreFoundation 0x3537e29f __CFRunLoopDoSources0 + 214
16 CoreFoundation 0x3537d045 __CFRunLoopRun + 652
17 CoreFoundation 0x353004a5 CFRunLoopRunSpecific + 300
18 CoreFoundation 0x3530036d CFRunLoopRunInMode + 104
19 GraphicsServices 0x36f9c439 GSEventRunModal + 136
20 UIKit 0x32e0ccd5 UIApplicationMain + 1080
21 MMBang 0x0002a583 MMBang + 169347
22 MMBang 0x00003810 MMBang + 10256
)
Go to breakpoints tab on xcode, in the bottom left hand corner there is a little plus button. Press it, click add exception breakpoint. Don't change any of the breakpoint settings and click done.
If you run your program again it should break on the line of code witch is crashing. As long as it is your code thats coursing this rather then an incorrect outlet in IB.
Hope this helps
Sam

Resources