dismissViewControllerAnimated crash in iOS8

不羁的心 提交于 2019-12-13 13:27:01

问题


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 ?


回答1:


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!




回答2:


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];
}


来源:https://stackoverflow.com/questions/26022347/dismissviewcontrolleranimated-crash-in-ios8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!