быстрое расширение ios дает ошибку сегментации 11 с xcode10 - PullRequest
0 голосов
/ 08 сентября 2018

Я использую swift 3.1, xcode 10 beta, cocapods 1.5.3

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

Но компилятор падает в строке, где расширение в основном из-за использования "где Self: ViewcontrollerAnimatedTransition"

xcode 9 работает нормально. но Xcode 10 дает ниже:

  1. Во время передачи SIL для «navigateInFlow (_ :)» в Flow.swift: 9: 3
  2. В то время как функция silgen emitFunction SIL "@ $ S12module12FilePAASo41ViewcontrollerAnimatedTransitionRzrlE010navigateInE0yySSF". для 'навигация (_ :)' в Flow.swift: ошибка 9: 3: ошибка сегментации: 11

Может кто-нибудь помочь?

Спасибо.

1 Ответ

0 голосов
/ 15 мая 2019

У меня была эта проблема, и она была решена путем изменения функции, содержащей параметр 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
        })
    }
...