Xcode 10 Generics typealias Segmentation Fault 11 while archiving
Xcode 10 Generics typealias Segmentation Fault 11 while archiving
在 Xcode 10
上归档 时出现分段错误
注:
- Xcode 10 build 和 运行 在设备和模拟器上工作正常
在 Xcode 9.4 中还有 archiving、build 和 运行 工作很好
我的代码:
typealias ResponseBlock<T> = (_ sender: T) -> Void
我在整个项目中都在使用它,例如:
var callback: ResponseBlock<AnyObject>?
在 Xcode 10 归档时出错:
- 同时生成 Objective-C header
- 打印时................................
- 同时打印类型 'ResponseBlock<[IndexPath]>'(声明于.....] RangeText="typealias ResponseBlock = (_ sender: T) -> V")
- 正在打印类型“(T)”时
错误:分段错误:11
用法:
var refreshCells: ResponseBlock<[IndexPath]>?
viewModel.refreshCells = {indexPathList in
self.collectionView.reloadItems(at: indexPathList)
}
我注意到 XCODE 10 Archive 处于发布模式和构建模式,运行 处于调试模式。
所以我查看了Release和Debug模式配置的区别
调查结果:
解法:
它解决了我的问题,现在不再收到分段错误。
将构建系统设置为使用遗留构建系统对我有用:
文件 > 工作区设置
在 Xcode 10
上归档 时出现分段错误注:
- Xcode 10 build 和 运行 在设备和模拟器上工作正常 在 Xcode 9.4 中还有 archiving、build 和 运行 工作很好
我的代码:
typealias ResponseBlock<T> = (_ sender: T) -> Void
我在整个项目中都在使用它,例如:
var callback: ResponseBlock<AnyObject>?
在 Xcode 10 归档时出错:
- 同时生成 Objective-C header
- 打印时................................
- 同时打印类型 'ResponseBlock<[IndexPath]>'(声明于.....] RangeText="typealias ResponseBlock = (_ sender: T) -> V")
- 正在打印类型“(T)”时 错误:分段错误:11
用法:
var refreshCells: ResponseBlock<[IndexPath]>?
viewModel.refreshCells = {indexPathList in
self.collectionView.reloadItems(at: indexPathList)
}
我注意到 XCODE 10 Archive 处于发布模式和构建模式,运行 处于调试模式。
所以我查看了Release和Debug模式配置的区别
调查结果:
解法:
它解决了我的问题,现在不再收到分段错误。
将构建系统设置为使用遗留构建系统对我有用:
文件 > 工作区设置