2
votes

My app consists of a parent view controller with 10 buttons that all lead to 10 different modal views, all of which have have quite a bit of content to them. The app runs perfectly on the simulator, but on the actual device, it receives many memory warnings, and sometimes crashes.

When testing the app on the simulator with the allocations instrument, I notice that the memory counts up and does not go down when I present or dismiss the modal views. I can even present and dismiss the same one over and over and the memory continually counts up.

My code for the modal view looks like this:

MyViewController *controller = [[MyViewController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:controller animated:YES];
[controller release];

Then for dismissing:

[self dismissModalViewControllerAnimated:YES];

I am releasing many buttons and image views in the dealloc method of the modal view controller. There are no problems when I analyze the program, no errors or warnings.

1

1 Answers

0
votes

This method is depreciated after iOS 6.0. Try this thread[1] instead.

[1]: Dismiss popover when clicking a uibutton "this link".