我正在使用 swift 3.1、xcode 10 beta、cocapods 1.5.3

extension WithdrawFlow where Self: ViewcontrollerAnimatedTransition {
func navigate()
 ...
}

但是编译器在扩展名处崩溃主要是由于使用了“where Self: ViewcontrollerAnimatedTransition”

xcode 9 工作正常。但 xcode 10 给出如下:



有人可以帮忙吗?

谢谢。

最佳答案

我遇到了这个问题,并且通过更改包含带有默认值的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/

10-10 20:30
查看更多