0
我使用的是UITableViewController
的在UIViewController
认为目前的UIViewController如可以看到下面:现在如何从的viewController的观点
UITableViewController *tvc = [[UITableViewController alloc] init];
[self.view addSubview:tvc.view];
,这里面UITableViewController
我希望能够呈现如有必要,请致电SFSafariViewController
。我写了下面的代码:
if (showLink) {
SFSafariViewController *sfsvc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:@"https://www.google.com"]];
[self.presentingViewController.navigationController pushViewController:sfsvc animated:YES];
}
每当我跑,我得到的控制台并没有什么下面的错误发生:
[Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFSafariViewController: 0x7f8aef82a600>)
任何想法如何,我可以解决这个问题?
我的代码?你的问题是你safari视图控制器是一个局部变量,它会在此函数退出时立即释放,大概是因为没有任何东西可以保留你的tableviewcontroller – Paulw11