I've a tabbar application with three tabs. On third tab there is a navigation controller and account setup is done there. Once the account setup is complete, I pop all the controllers on that tab and change the selected tab to first. But after then when I select the tab to third, application crash with message "message sent to deallocated instance 0x15d17cc0"
. This issue occurs only on iOS 7 and not happening on iOS 6 or below.
Asked
Active
Viewed 8,233 times
3

Sufian Latif
- 13,086
- 3
- 33
- 70

Afnan
- 888
- 1
- 13
- 37
-
2Hard to guess without any code. Did you try to run your project under instruments with zombie detection enabled? It will should tell you perfectly which object is getting referenced after deallocation. – Leijonien Nov 20 '13 at 08:20
-
I assume you are not using ARC. If so I strongly suggest converting your app to ARC - it will eliminate most of the memory management problems. – Reinhard Männer Nov 20 '13 at 08:22
-
Please show us the code that pops all your third tab's view. Maybe you're deallocating the navigation controller as well ? – shinyuX Nov 20 '13 at 08:50
-
@shinyuX it is `[self.tabBarController setSelectedIndex:0]; [self.navigationController popToRootViewControllerAnimated:NO];` – Afnan Nov 20 '13 at 09:50
-
@Leijonien yes, I did check it in instruments following line appears as zombie `-[UISearchBar _didMoveFromWindow:toWindow:] + 156`. – Afnan Nov 20 '13 at 14:42
-
@Afnan I was also facing same issue do you got any solution for this ?? – The iCoder Apr 15 '14 at 16:57
-
@PavanMore No, I'd to add a little delay before changing tab. – Afnan Jun 17 '14 at 13:09
-
2This issue should be reopened since there may be no "code" involved since the problem can be created using vanilla/boilerplate code and storyboards. – Kyle Jul 11 '14 at 02:22
-
@Kyle you can vote to reopen this question. I can still reproduce this issue. – Afnan Aug 14 '14 at 14:23
1 Answers
2
Add Exception Breakpoint from Breakpoint Navigator and find what that instance is. Most probably your problem is a simple memory management problem and it will be fixed when you autorelease that instance instead of retaining at first.
Edit: Also you can look at this great answer

Community
- 1
- 1

Mert Buran
- 2,989
- 2
- 22
- 34
-
While enable zombies it print following message in the console log "*** -[AddLocationsViewController respondsToSelector:]: message sent to deallocated instance 0x15d17cc0" When I pop to root viewcontroller, dealloc is properly called on all viewcontrollers except the root. – Afnan Nov 20 '13 at 09:39
-
I guess you can add a breakpoint into that method and debug it step by step unless you don't want to use Exception Breakpoint. – Mert Buran Nov 20 '13 at 09:43
-
It didn't helped. Once it go through line when controllers are poped no exception is being thrown and dealloc(s) are called. And When I change the tab from 1st to third it crash and message appears in console log _*** -[AddLocationsViewController respondsToSelector:]: message sent to deallocated instance 0x15d17cc0_. – Afnan Nov 20 '13 at 09:48
-
You are probably doing it wrong, the problem is trying to access an object after its dealloc method is called, therefore you should keep an eye on the methods called afterwards. Your problem is a very general problem btw – Mert Buran Nov 20 '13 at 10:18