在 Swift 4 中通过窥孔优化结合 SIL 指令

Combine SIL Instructions via Peephole Optimization in Swift 4

当我为 App Store 存档项目时,出现错误 Segmentation fault 11 1. 虽然 运行 通过 #317780 SILFunctionTransform ""Combine SIL

Instructions via Peephole Optimization"" on SILFunction "@_T08myapp20ItchMessageViewModelC05photoC0AA0bcE8Protocol_pfgAA04ChatbcE0C_Tg5".
for getter for photoMessage at /Users/work/Desktop/myappProject/myappiOS/myapp/Groups/ChatGroup/ChatFactory/Bubbles/VideoBubble/Model/ItchMessageViewModel.swift:38:16

这段代码看起来像这样

open class ItchMessageViewModel<ItchMessageModelT: ItchMessageModelProtocol>: ItchMessageViewModelProtocol {

    public var itchID: String
    public var itchName: String

    public var photoMessage: ItchMessageModelProtocol { **This is 38 line**
        return self._itchMessage
    }

    public let _itchMessage: ItchMessageModelT
    public var transferStatus: Observable<TransferStatus> = Observable(.idle)
    public var transferProgress: Observable<Double> = Observable(0)
    public var transferDirection: Observable<TransferDirection> = Observable(.download)
    public var image: Observable<UIImage?>
    open var imageSize: CGSize {
        return self.photoMessage.imageSize
    }
    public let messageViewModel: MessageViewModelProtocol
    open var showsFailedIcon: Bool {
        return self.messageViewModel.showsFailedIcon || self.transferStatus.value == .failed
    }

    public init(itchMessage: ItchMessageModelT, messageViewModel: MessageViewModelProtocol) {
        self._itchMessage = itchMessage
        self.image = Observable(itchMessage.image)
        self.messageViewModel = messageViewModel
        self.itchName = itchMessage.itchName
        self.itchID = itchMessage.itchID
    }

    open func willBeShown() {
        // Need to declare empty. Otherwise subclass code won't execute (as of Xcode 7.2)
    }

    open func wasHidden() {
        // Need to declare empty. Otherwise subclass code won't execute (as of Xcode 7.2)
    }
}

但设备或错误模拟器没有构建时间。我该如何解决?

我认为这不是最佳解决方案,但它帮助了我。

在项目设置中,我选择了target MyApp -> Build Settings -> Optimization Level -> Release None [-Onone].

我正在考虑为 Apple 创建错误报告,因为此代码来自 Chatto framework,我也没有打算。