ios - RxTest:体系结构 x86_64 和 arm64 的 undefined symbol

标签 ios swift rx-swift rx-cocoa rxtest

我正在尝试运行第 16 章中的以下测试:使用 RxTest 测试 of Raywenderlich RxSwift 书:

import XCTest
import RxSwift
import RxTest
@testable import Testing

class TestingViewModel : XCTestCase {

var viewModel: ViewModel!
var scheduler: ConcurrentDispatchQueueScheduler!

override func setUp() {
super.setUp()

viewModel = ViewModel()
scheduler = ConcurrentDispatchQueueScheduler(qos: .default)
}

func testColorNameIsRayWenderlichGreenWhenHexStringIs006636() {

// 1
let colorNameObservable = viewModel.colorName.asObservable().subscribeOn(scheduler)

// 2
viewModel.hexString.value = "#006636"

// 3
XCTAssertEqual("rayWenderlichGreen", try! colorNameObservable.toBlocking().first()!)
 }
}

但是我在模拟器上得到这个错误:

Undefined symbols for architecture x86_64: "type metadata for RxCocoa.DriverSharingStrategy", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o "protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o "RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

iPhone 6s 上的这个:

Undefined symbols for architecture arm64: "type metadata for RxCocoa.DriverSharingStrategy", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o "protocol witness table for RxCocoa.DriverSharingStrategy : RxCocoa.SharingStrategyProtocol in RxCocoa", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o "RxCocoa.SharedSequence.asObservable() -> RxSwift.Observable", referenced from: TestingTests.TestingViewModel.testColorNameIsRayWenderlichGreenWhenHexStringIs006636() -> () in TestingViewModel.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Unfortunately, there is no support for this issue in Raywenderlich's forums.

最佳答案

经过大量搜索,正如有人建议的那样here对于另一个类似的问题,我发现这个错误将通过导入 RxCocoa 来解决。

关于ios - RxTest:体系结构 x86_64 和 arm64 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50465639/

相关文章:

swift - CocoaPods RxCocoa 3.6.1 构建在 Xcode 9 中失败

ios - 有什么方法可以在 iOS 上注册 url schemes 吗?

ios - 为什么将静态引用传递给类会消耗内存?

swift - 什么是 Typescript 联合类型的 Swift 等价物?

ios - 如何使用 RxSwift 正确处理项目中的 Disposables?

ios - subscribeNext 和 bindNext 的区别

ios - 将 GMSMapView 限制在特定范围内

iphone - 如何在ios上实现360度展示案例?

ios - Swift:无法删除具有基于条件的字符限制的文本字段中的字符

swift - windowWillClose 和按钮操作未调用 Swift