I’m getting EXC_BAD_ACCESS but I don’t know anymore what to do.
I get the error when I try to switch tabs (UITabBar). Nothing executes according to NSLog.
The tabbar tab event is a segue where no code of me gets executed…
(arc enabled)
edit:
When I enable zombies, I get *** -[TDAppDelegate respondsToSelector:]: message sent to deallocated instance 0x6e8a260
I can press the rightBarButtonItem, the modal view is presented and just works (it also communicates with the appdelegate). When the modal view is dismissed, and I try to switch tabs, the app crashes again. [UITabBarDelegate tabBar:didSelectItem:] gets called.
stack:
(gdb) info malloc-history 0x6e8a260
Alloc: Block address: 0x06e8a260 length: 44
Stack - pthread: 0xac4932c0 number of frames: 32
0: 0x9428c90b in malloc_zone_calloc
1: 0x9428d837 in calloc
2: 0x1bc1c93 in class_createInstance
3: 0x1bcc88b in _objc_rootAllocWithZone
4: 0x17de661 in +[NSObject allocWithZone:]
5: 0x1bcc8b9 in _objc_rootAlloc
6: 0x66f2d6 in -[UIClassSwapper initWithCoder:]
7: 0x76dfa2 in UINibDecoderDecodeObjectForValue
8: 0x76d6b7 in -[UINibDecoder decodeObjectForKey:]
9: 0x66eead in -[UIRuntimeConnection initWithCoder:]
10: 0x76dfa2 in UINibDecoderDecodeObjectForValue
11: 0x76d9af in UINibDecoderDecodeObjectForValue
12: 0x76d6b7 in -[UINibDecoder decodeObjectForKey:]
13: 0x66e305 in -[UINib instantiateWithOwner:options:]
14: 0x87484f in -[UIStoryboard instantiateViewControllerWithIdentifier:]
15: 0x87499e in -[UIStoryboard instantiateInitialViewController]
16: 0x4501e3 in -[UIApplication _loadMainStoryboardFileNamed:bundle:]
17: 0x450461 in -[UIApplication _loadMainInterfaceFile]
18: 0x44f7c0 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:]
19: 0x45e743 in -[UIApplication handleEvent:withNewEvent:]
20: 0x45f1f8 in -[UIApplication sendEvent:]
21: 0x452aa9 in _UIApplicationHandleEvent
22: 0x1feafa9 in PurpleEventCallback
23: 0x17b01c5 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
24: 0x1715022 in __CFRunLoopDoSource1
25: 0x171390a in __CFRunLoopRun
26: 0x1712db4 in CFRunLoopRunSpecific
27: 0x1712ccb in CFRunLoopRunInMode
28: 0x44f2a7 in -[UIApplication _run]
29: 0x450a9b in UIApplicationMain
30: 0x2a18 in main at /Users/user/Desktop/app/main.m:16
31: 0x2975 in start
As a hunch you are crashing because you don’t have enough memory left. One of the relevant views or view controllers is being held because its referenced under ARC as
strongwhenweakwould be more appropriate.Also go looking in your code for instances of
respondsToSelector:. It might not be the delegate that is trying to be messaged in this instance. It’s a red herring. My experience is that those “sent to deallocated instance” console logs rarely tell you the actual object which was being messaged.