我正在使用 swift 3.1、xcode 10 beta、cocapods 1.5.3
extension WithdrawFlow where Self: ViewcontrollerAnimatedTransition {
func navigate()
...
}
但编译器在扩展所在的行崩溃主要是由于使用了“where Self: ViewcontrollerAnimatedTransition”
xcode 9 工作正常。但 xcode 10 在下面给出:
- While emitting SIL for 'navigateInFlow(_:)' at Flow.swift:9:3
- While silgen emitFunction SIL function "@$S12module12FilePAASo41ViewcontrollerAnimatedTransitionRzrlE010navigateInE0yySSF". for 'navigate(_:)' at Flow.swift:9:3 error: Segmentation fault: 11
有人可以帮忙吗?
谢谢。
最佳答案
我遇到了这个问题,通过更改包含具有默认值的 inout
参数的函数解决了这个问题。告诉我错误的函数是我的应用程序中第一次调用它的地方。
旧:
/// Creates a new Icon button with the specified tint color, image and pulse animation
convenience init(withTintColor tint: inout BehaviorRelay<UIColor> = UIColor.navBarTintColor,
tintedImage: UIImage?,
pulseAnimation: PulseAnimation = .centerRadialBeyondBounds
) {
self.init(image: tintedImage?.withRenderingMode(.alwaysTemplate))
self.pulseAnimation = pulseAnimation
_ = (tint ?? UIColor.navBarTintColor).asObservable().subscribe(onNext: { [weak self] (newColor) in
self?.tintColor = newColor
self?.imageView?.tintColor = newColor
})
}
新:
/// Creates a new Icon button with the specified tint color, image and pulse animation
convenience init(tintedImage: UIImage?,
pulseAnimation: PulseAnimation = .centerRadialBeyondBounds
) {
self.init(image: tintedImage?.withRenderingMode(.alwaysTemplate))
self.pulseAnimation = pulseAnimation
_ = UIColor.navBarTintColor.asObservable().subscribe(onNext: { [weak self] (newColor) in
self?.tintColor = newColor
self?.imageView?.tintColor = newColor
})
}
关于ios - swift ios 扩展使用 xcode10 给出段错误 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52232691/