首页 > 解决方案 > Xcode 10 Generics typealias Segmentation Fault 11 归档时

问题描述

Xcode 10上归档时出现分段错误

笔记:

我的代码:

typealias ResponseBlock<T> = (_ sender: T) -> Void

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

var callback: ResponseBlock<AnyObject>? 

在 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)
}

标签: iosswiftgenericsxcode10type-alias

解决方案


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

所以我检查了ReleaseDebug模式配置的区别

发现: 在此处输入图像描述

解决方案: 在此处输入图像描述

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


推荐阅读