测试RX在调度程序初始化上引发错误

时间:2019-05-27 18:28:07

标签: ios swift

如果我写var scheduler = TestScheduler(initialClock: 0)

,单元测试就会终止

我的进口

import XCTest
import RxTest

有错误消息

  

无法从错误的名称'7RxSwift20VirtualTimeSchedulerCy0A4Test0fecD9ConverterVG'分解TestScheduler的超类

pod版本

pod 'RxBlocking', '~> 5'
pod 'RxTest', '~> 5'

1 个答案:

答案 0 :(得分:2)

这是Cocoapods + XCode 10.2平台的错误。

XCode 10.2 RC中的声明涉及已知问题:

Linking against a static Swift library might create a binary with missing 
type metadata because the object files that define the metadata inside the 
static archive are mistakenly considered unused. (47598583)

This can manifest as a Swift runtime error with a message such as:
“failed to demangle superclass of MyClass from mangled name ‘<mangled name>’”.

Workaround: If you can rebuild the static library, try building it with whole module 
optimization enabled. 
Otherwise, add -all_load to the linker flags in the client binary to 
ensure all object files are linked into it.

这个thread和这个solution应该可以帮助您摆脱它。