I got stuck by this error message because for three days I didn’t find the object _cfTypeID neither the object’s address noted after that message. I know that there must be an array that I access but it is already destroyed.
My iPhone app is based on a tab bar controller and with one tab I switch to a new view controller which creates a navigation view controller and hide the whole tab bar controller from being accessed. I’ve chosen this way because the whole tab bar view logic runs in portrait orientation while the navigation view controller does its job in landscape orientation.
The first run is always fine when it starts with any portrait view via tab bar, changing to the landscape view of the navigation view controller. I have three views pushed on the navigation stack. On the first run there is also no crash when I navigate back to the root controller, leave this on and get back to the tab bar controller’s last visible view. At that point the navigation view controller gets deallocated.
The crash happens on the second run, navigating again from the tab bar controller to the navigation view controller down to the third pushed view controller. At that point the navigation view controller and its three view controllers on stack are recreated. The crash happens when I leave the bottom most view on the stack either by pressing the backBarButton or the rightBarButton which I have created as a Done button.
I’ve not yet found where I’m not fine with the memory management as I don’t have an array that’s called _cfTypeID myself nor do I access this array directly. GDB goes crashing during a call to synchronize of NSUserDefaults which I use in viewWillDisappear of the view that just gets off screen. Instruments with the Leaks tool terminates the process after this crash and its messages are not helpful for me.
…and there is a difference of behaviour between running in the simulator and on the device (which is iPhone 4): on the device I can pop one more view controller from the navigation view controller and get the crash when leaving the view by the backBarButton.
I’ve decided not to post any code lines because there is lots of it and might not make sense to put it right in here. But I can supply parts of it if needed. I’ll be glad for hints to tools I can use to identify either the broken array or anything else to revise my memory management (which is of course not perfect as I’m quite new to objc coming from c++ and php).
Cheers,
Konran
_cfTypeIdis not the name of the array, it’s the name of the message being sent to an instance ofCFArray. The specific error is coming from somewhere inside the framework code which is why you don’t recognize anything about it, but the cause is that something in your code is either not retaining something it should be, is releasing something that it shouldn’t, or is prematurely releasing something that it still wants to be using.BTW, don’t use
retainCount, it doesn’t work like you think and is generally useless.