1

Ok, now this has been really mind-boggling for me and I really can not make any sense out of it... I googled it and still nothing.

I have a UINavigationController set up that pushes a root view controller. The root view controller then pushes a new view controller (actually it's a TableViewController) when a UIButton is pressed, and here's where things get weird.

The app only crashes if I set "animated" to "YES".

[[self navigationController] pushViewController:listView animated:YES];

If I change this and set "animated" to "NO", the app continues normally and functions superbly... I set "animated" back to "YES", and it crashes again.

Ultimately, I would love it if I could retain the animation, it is one of the most beautiful things about iOS after all, but with this current situation, I can't for the life of me figure out what is going on.

Please help me figure out what could be going wrong here.

Johnny
  • 11
  • 2
  • 1
    It's difficult to help without knowing what the exception and/or stack trace is. – Stephen Darlington Aug 22 '11 at 12:53
  • 1
    I would recommend that you turn on your zombies and run the app in Instruments, this should show you what is being released and then accessed, which is probably the source of your crash. http://stackoverflow.com/questions/5386160/how-to-enable-nszombie-on-xcode-4 – BP. Aug 22 '11 at 13:02

2 Answers2

1

When the animation is turned on Core Animation is accessing CALayer objects, the drawn parts of the views, from both the root view controller and the new view controller. When the animation is turned off Core Animation doesn't need the root view controller's CALayer objects. Maybe you're releasing some view in the root view and it's backing CALayer object too quickly.

Mr. Berna
  • 10,525
  • 1
  • 39
  • 42
1

Thank you Mr. Berna, you actually gave me the tip that led me to the solution. The thing is that the view controller I was pushing is actually a table view controller, whose cells are created dynamically based on the entries found in an NSArray. I was initializing the NSArray in the viewDidLoad function, however I had set it to autorelease, so it was being released from memory before the view could be drawn by CALayer.

Johnny
  • 11
  • 1