更新到最新的iPhone iOS 13.0后,出现此错误。但是应用在iOS 12.0中运行正常
以下是错误:
由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[NSNull renderingMode]:无法识别的选择器已发送到实例
这是我的代码:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
vc.tabBarItem = UITabBarItem(title: nil, image: UIImage(named: "home-unselected")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal), selectedImage: UIImage(named: "selected-Home")?.withRenderingMode(UIImage.RenderingMode.alwaysOriginal))
if CurrentDevice == Ipad {
if L102Language.currentAppleLanguage() == "en" {
vc.tabBarItem.imageInsets = UIEdgeInsets(top: -5, left: 0, bottom: -5, right: 0)
}else{
vc.tabBarItem.imageInsets = UIEdgeInsets(top: -5, left: 43.5, bottom: -5, right: -43.5)
}
}else{
if L102Language.currentAppleLanguage() == "en" {
vc.tabBarItem.imageInsets = UIEdgeInsets(top: -5, left: 0, bottom: -5, right: 0)
}else{
vc.tabBarItem.imageInsets = UIEdgeInsets(top: -5, left: 0, bottom: -5, right: 0)
}
}
nav1.viewControllers = [vc]
self.selectedIndex = 0