swift - 初始化程序的问题:在 super.init 调用时未初始化属性“self.options”
问题描述
我正在使用来自 cocoapods 的SwiftPageMenu 。它曾经完美地工作。但是在我通过 pod 重新安装它之后,我不断收到这个错误
线程 1:致命错误:init(coder:) 尚未实现
我寻找了一些解决方案,主要建议改变:
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
至 :
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
但我明白了
属性“self.options”未在 super.init 调用中初始化
options 在其他 init 函数中初始化:
public init(options: PageMenuOptions? = nil) {
self.options = options ?? DefaultPageMenuOption()
super.init(nibName: nil, bundle: nil)
}
public init?(coder: NSCoder, options: PageMenuOptions? = nil) {
self.options = options ?? DefaultPageMenuOption()
super.init(coder: coder)
}
我真的不明白这个问题有人可以帮助我吗?
这是控制器
解决方案
推荐阅读
- c++ - 无法从 C++ 中的 Windows 窗体应用程序将数据插入 mysql 数据库
- javascript - 使用 jQuery 显示多张图片的文本信息
- python - 使用 range() 和使用 for 循环有什么区别?
- type-hinting - 仅用于类型提示时应该导入类吗?政治力量 560
- c# - 在类文件中声明对象类型列表给出“缺少使用指令或程序集引用”错误
- xml - perl XML设置标签值问题
- wordpress - 创建新帖子时自动显示所有自定义字段
- c++ - MacOSX 上的 IOstream
- ggplot2 - R更改ggplot散点图颜色
- firebase - 从 Android Firebase 检索数据,将其显示到 listview 并将 onItemClickListener 应用于 ListView