RxTest: Undefined symbols for architecture x86_64 and arm64

ぐ巨炮叔叔 提交于 2019-12-11 02:45:40

问题


I am trying to run the following test from Chapter 16: Testing with RxTest of Raywenderlich RxSwift book:

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()!)
 }
}

But I get this error on the simulator:

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)

And This one on 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.


回答1:


After a lot of searches, As somebody suggests here for another similar issue I found that this error will be solved by importing RxCocoa.



来源:https://stackoverflow.com/questions/50465639/rxtest-undefined-symbols-for-architecture-x86-64-and-arm64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!