存档时Xcode 10 Generics typealias Segmentation Fault 11

Muh*_*een 5 generics ios type-alias swift xcode10

Xcode 10存档时出现分段错误

注意:

  • Xcode 10 在设备和模拟器上构建运行正常,在Xcode 9.4中,归档,构建运行也很好

我的代码:

typealias ResponseBlock<T> = (_ sender: T) -> Void
Run Code Online (Sandbox Code Playgroud)

我在整个项目中使用它,如:

var callback: ResponseBlock<AnyObject>? 
Run Code Online (Sandbox Code Playgroud)

在Xcode 10上存档时出错:

  1. 同时生成Objective-C头
  2. 打印时................
  3. 打印类型'ResponseBlock <[IndexPath]>'(声明在.....] RangeText ="typealias ResponseBlock =(_ sender:T) - > V")
  4. 打印类型'(T)' 错误:分段错误:11

用法:

var refreshCells: ResponseBlock<[IndexPath]>?
viewModel.refreshCells = {indexPathList in 
     self.collectionView.reloadItems(at:   indexPathList)
}
Run Code Online (Sandbox Code Playgroud)

Muh*_*een 6

我注意到 XCODE 10 Archive 处于发布模式和构建,运行处于调试模式。

所以我检查了发布调试模式配置之间的区别

发现: 在此处输入图片说明

解决方案: 在此处输入图片说明

它解决了我的问题,现在不再收到分段错误。