dismissViewControllerAnimated crash in iOS8

2019-06-27 05:07发布

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 ?

2条回答
再贱就再见
2楼-- · 2019-06-27 05:39

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!

查看更多
太酷不给撩
3楼-- · 2019-06-27 05:47

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];
}
查看更多
登录 后发表回答