4

I have a application that work very well in iOS7.0/7.1 Since the last iOS update (8.0) the dismissViewControllerAnimated crash every time. Someone saw the same thing ?
I have a control this to call the second controller:

**detailViewController.delegate = self;
[self presentViewController:detailViewController animated:YES completion:nil];**

and in the close button I use this:

**// Do something with the sender if needed
[viewController dismissViewControllerAnimated:YES completion:NULL];**

I Used this (Remove view controller from another view controller) as a guide for implementation the "second" control but the crash appear again.

Any ideas ?

Community
  • 1
  • 1
Mah
  • 51
  • 1
  • 3
  • How about the idea that if you ask a question about a "crash" you include the complete, exact exception message plus the exception stack trace? – Hot Licks Sep 24 '14 at 17:17
  • Since this user is apparently very new to SO, we should ask him if the error he got said "EXC_BAD_ACCESS". – Zia Sep 24 '14 at 19:22
  • I've got the same thing going on in the ShareKit library with the EXC_BAD_ACCESS error. Not to hijack the thread, but I've verified the presented ViewController and the presenting ViewController both are still alive at a breakpoint just before the crash. Also verified it is iOS 8 only. – Steve Y Sep 25 '14 at 16:07

2 Answers2

5

I had a very similar issue when I was dismissing programmatically. (like when a delegate finished a process).

I used this and it worked perfectly:

if (![self isBeingDismissed]) {
    [self dismissViewControllerAnimated:YES completion:^{
    }];
}

It simply checks to see if it was already in the process of being dismissed. Hope this works for you!

Wapiti
  • 80
  • 1
  • 9
  • @Andrew You can add this code wherever you want to dismiss the view controller. You don't need to override anything. In my case, it was an IBAction method of a "Cancel" button. – Wapiti Oct 16 '15 at 06:47
0

Check if there is any dealloc function defined as mentioned below. As it might led to Crash Sometimes.

- (void)dealloc {
      [_yourview release]; //don't do this
      [super dealloc];
}
BharathRao
  • 1,846
  • 1
  • 18
  • 28