您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页“Attempting to load the view of

“Attempting to load the view of

来源:伴沃教育

出现的问题原因,从一个控制器modal到一个带有搜索控制器,然后从搜索控制器返回的时候,会出现这个警告

Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<UISearchController: 0x154d39700>)

解决办法:
Objective-C...

-(void)dealloc { 
    [searchController.view removeFromSuperview]; // It works!
}

Swift 3...

deinit {
    self.searchController.view.removeFromSuperview()
}

引用

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务