【问题标题】:swift ios extension gives segmentation fault 11 with xcode10swift ios 扩展使用 xcode10 给出分段错误 11
【发布时间】:2018-09-08 06:33:25
【问题描述】:

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

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

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

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

  1. 在 Flow.swift:9:3 为“navigateInFlow(_:)”发出 SIL 时
  2. 虽然 silgen emitFunction SIL 函数“@$S12module12FilePAASo41ViewcontrollerAnimatedTransitionRzrlE010navigateInE0yySSF”。 对于 Flow.swift:9:3 处的“导航(_:)”错误:分段错误:11

有人可以帮忙吗?

谢谢。

【问题讨论】:

    标签: ios swift segmentation-fault xcode10


    【解决方案1】:

    我遇到了这个问题,并通过更改包含 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
            })
        }
    

    【讨论】:

      猜你喜欢
      • 2023-04-04
      • 2018-11-26
      • 2016-01-10
      • 1970-01-01
      • 2017-02-13
      • 2020-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多