swift - Swift 线程 1:EXC_BAD_ACCESS(代码=2,地址=0x7ffeedbbaff8)
问题描述
我正在尝试让 pod 工作。它来自这里:
https://github.com/Ahmadalsofi/SOTabBar
直到运行时我才收到错误,在那里我得到了一长串看起来像是线程循环的东西。
图片:
1.踏栈
2.发生错误的行
3.错误信息
- 我可以将错误追踪到:
我的场景委托进入应用程序:(我没有使用故事板)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = MainTabBarVC()
window?.makeKeyAndVisible()
}
}
我的 MainTabBarVC:
import UIKit
import SOTabBar
class MainTabBarVC: SOTabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let firstVC = SearchVC(nibName: "Main", bundle: nil)
let secondVC = TestVC(nibName: "Main", bundle: nil)
firstVC.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "mappin.and.ellipse"), selectedImage: UIImage(systemName: "star"))
secondVC.tabBarItem = UITabBarItem(title: "Chat", image: UIImage(named: "secondImage"), selectedImage: UIImage(systemName: "mappin.and.ellipse"))
viewControllers = [firstVC, secondVC]
}
override func loadView() {
super.loadView()
SOTabBarSetting.tabBarHeight = 60.0
SOTabBarSetting.tabBarTintColor = UIColor.red
SOTabBarSetting.tabBarBackground = UIColor.purple
SOTabBarSetting.tabBarCircleSize = CGSize(width: 50.0, height: 50.0)
SOTabBarSetting.tabBarSizeImage = CGFloat(20)
SOTabBarSetting.tabBarSizeSelectedImage = CGFloat(40)
SOTabBarSetting.tabBarAnimationDurationTime = 2
}
}
extension MainTabBarVC: SOTabBarControllerDelegate {
func tabBarController(_ tabBarController: SOTabBarController, didSelect viewController: UIViewController) {
print("Hello")
}
}
我的 SearchVC 和 TestVC 只是具有不同背景颜色的简单 VC,例如:
import UIKit
class SearchVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemRed
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
}
视图控制器本身很好,问题似乎是 pod。我尝试查看他们的 github 源代码,但我不知道是什么原因造成的。所以问题要么是 pod,要么是我的实现。
解决方案
推荐阅读
- java - Intelij 用新名称创建新包
- amazon-web-services - 从 Google Scripts 到 AWS Lambda 的 POST 请求以 null 的形式通过
- azure-active-directory - 开发和测试 Live Active Directory B2C 租户的更新
- django - Celery beat 卡在“写条目……”。芹菜工人工作正常
- rust - 如何为外部类型实现 serde 的反序列化和序列化?
- html - 为什么我的部分元素没有显示为正文的一部分?
- mongodb - Mongodb:$四舍五入十进制
- typescript - 'IntrinsicAttributes & Props & { children?: ReactNode; 类型上不存在属性 'customerCode' }'
- mongodb - 在查找查询中引用自己的项目字段
- objective-c - 我应该为自己的网络浏览器使用哪个用户代理?