[英]EXC_BAD_ACCESS when popViewController
I am pushing BViewController from A properly. 我正确地从A推BViewController。 B contains a webview that starts loading a page when viewDidLoad.
B包含一个webview,它在viewDidLoad时开始加载页面。 I am getting a strange behavior when popping B to A,
将B弹出到A时出现奇怪的行为,
I checked on both situations viewcontrollers that are on navigation stack. 我检查了导航堆栈上的两种情况的ViewController。 Both cases with same result, 2 same objects, no difference!
两种情况都具有相同的结果,两个相同的对象,没有区别!
-(IBAction)goBackOrg:(id)sender{
NSArray *viewControllers = self.navigationController.viewControllers;
[[self navigationController] popViewControllerAnimated:NO];
}
and for previously pushing it, I am using 对于以前的推动,我正在使用
if(!self.BController){
self.BController = [[BViewController alloc] initWithNibName:@"BViewController" bundle:nil anUrlDest:urlSocial];
}
[[self navigationController] pushViewController:self.BController animated:NO];
EXC_BAD_ACCESS occurs when you're trying to access an object that has been deallocated. 当您尝试访问已释放的对象时,发生EXC_BAD_ACCESS。
So the following could be your problem: when you pop ViewController B, it is being unloaded. 因此,以下可能是您的问题:弹出ViewController B时,它正在被卸载。 If the web view loading finishes after ViewController B is unloaded, some piece of callback code is getting executed that is trying to do something with your ViewController or its view (or similar).
如果在卸载ViewController B后完成Web视图的加载,则将执行一些回调代码,试图对ViewController或其视图(或类似视图)执行某些操作。
May be You are loading your webView on Thread
and when you are using thread then you cannot do changes in UI otherwise your app will crash. 可能是您正在
Thread
上加载webView,而当您使用线程时,则无法在UI中进行更改,否则您的应用程序将崩溃。
So just do this task on mainThread . 因此,只需在mainThread上执行此任务即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.