0
votes

My application crashes when I navigate to different view for more than 10 to 11 times. I mean I have 6 buttons on main screen which on pressing bring you to different views. when I press these buttons repeatedly then my app crashes. I have spent 3 days but comes up with no solution. here is the code where app crashes

when i uncomment release statement then it crashes after first time.

-(IBAction) goToLiveAlerts{
    teamAlerts *showLiveAlerts=[[teamAlerts alloc] initWithNibName:@"teamAlerts" bundle:nil];
    [self.navigationController pushViewController:showLiveAlerts animated:YES];
        //[showLiveAlerts release];
}

when i uncomment then i console error is "wait_fences: failed to receive reply: 10004003 [Switching to process 2093] [Switching to process 2093] Program received signal: “EXC_BAD_ACCESS”." -(IBAction)goToPhotos{ picturesGallery *showPictures=[[picturesGallery alloc] initWithNibName:@"picturesGallery" bundle:nil]; [self.navigationController pushViewController:showPictures animated:YES]; //[showPictures release]; }

1
Provide the code and crash backtrace please. We're not telepathic.Eimantas
Have you profile your app and see whether the views not in focus are deallocated?nhahtdh
how to deallocate the views which are not in focus. kindly provide example. It will help me to understandIdrees Ashraf
You will be required to release the objects while viewDidDisappear method. This kind of error comes off when memory is not managed properly. You are creating the objects but they are not released at the appropriate instant.Akhilesh Sharma
Please provide the code you have written. Are you using ARC ?Omer Waqas Khan

1 Answers

0
votes

Do you use ARC or not? If not, according to your code, there is some memory leaks in your code, try this:

-(IBAction)goToPhotos{
    picturesGallery *showPictures=[[picturesGallery alloc] initWithNibName:@"picturesGallery" bundle:nil];
    [self.navigationController pushViewController:showPictures animated:YES];
    [showPictures release];
}

Anyway, you need to provide more code crash log.


According to your crash log, EXC_BAD_ACCESS means there is some memory leaks. Enable NSZombie in Xcode to debug. In Xcode 4.3, go to Product->Edit Scheme->Diagnostics and check Enable Zombie Objects.