UIView Controller mysteriously getting deallocated

Posted by Dan Ray on Stack Overflow See other posts from Stack Overflow or by Dan Ray
Published on 2010-05-17T18:37:38Z Indexed on 2010/05/17 18:40 UTC
Read the original article Hit count: 387

I have a UINavigation scheme with a "welcome" page, a middle page, and a detail page.

In the middle page, there's a segmented controller that can swap the main body of that page between a table, a calendar, and a MKMapView, each implemented with their own view controller classes.

Today I implemented the MapView and its annotations and all of that. It's nice. And a detail disclosure on each callout takes you to the detail page just the same way as if you'd gotten there via the table. Lovely.

I also have a right-button-bar button that pushes in a "search" view. From there you can search the data I'm navigating. When it's done filtering the data (an array of objects I'm keeping in a data singleton), it makes the table reload its data, and calls my annotation-clearer-and-builder methods on the map view, and then pops itself out, so the "middle" page (including whatever view was in the guts of it) is back on the screen.

Problem is, if I go back and forth between the map and the search a couple times, any mention of the table view causes us to crash with: *** -[CALayer retain]: message sent to deallocated instance 0x710b810. (I obviously have NSZombies turned on.)

I put an NSLog in the dealloc method of my table view controller. That thing's never getting called. I don't know if we're ditching it behind the scenes for memory purposes, or if I'm leaking it and can't get my hands back on it, or what. I'm sort of at a loss about where to look. Any hints?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone