I have upgraded to swift 4.1 from 4.0.
I have changed all the ...value = newValue to ...accept(value:newValue)
I am getting
Undefined symbols for architecture arm64:
"__T07RxCocoa13BehaviorRelayC6acceptyxF", referenced from:
__T023ConnectionManager_Tests15BlowSessionTestC012testCanStartE0yyF in BlowSessionTest.o
__T023ConnectionManager_Tests07CommandC0C04testaB25GetIntFromDeviceIsCorrectyyFyycfU_ in CommandTests.o
__T023ConnectionManager_Tests07CommandC0C04testaB28GetStringFromDeviceIsCorrectyyFyycfU_ in CommandTests.o
"__T07RxCocoa13BehaviorRelayC5valuexfg", referenced from:
__T023ConnectionManager_Tests15BlowSessionTestC012testCanStartE0yyF in BlowSessionTest.o
__T023ConnectionManager_Tests0aB4TestC31testIsSyncingChangesWhenStoppedyyFSbyKXKfu_ in ConnectionManagerTest.o
__T023ConnectionManager_Tests0aB4TestC24testIsSyncingWhenStartedyyFSbyKXKfu_ in ConnectionManagerTest.o
"__T07RxCocoa13BehaviorRelayC12asObservable0A5Swift0F0CyxGyF", referenced from:
__T023ConnectionManager_Tests15BlowSessionTestC023testAddingFiveCompletedd16CorrectlyChangesE0yyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC027testAddingMultipleCompletedd16CorrectlyChangesE0yyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC031testCompletionOnlyFiresOnceWhenE11IsCompletedyyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC43testAdding75GoodBlowsGetsCorrectCompletionsyyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC043testAdding75GoodBlowsGetsCorrectCompletionsF9ScheduleryyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC14test321sessionyyF in BlowSessionTest.o
__T023ConnectionManager_Tests15BlowSessionTestC027testAddingMultipleCompletedd16CorrectlyChangesE9GotFromDbyyF in BlowSessionTest.o
errors in all my unit test
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
4.10
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
Version 9.2 (9C40b)
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
Hi @markGilchristBookingBug ,
did you try cleaning your derived data directory? Why do you think this is a problem with the project? As far as I can tell unit tests are passing.
hi @kzaher,
I have deleted the derived data and cleaned the project and I still have the problem
I have also deleted the projected, then cloned it fresh from git the run pod update and I still have the problem
I am getting the linker error where ever I reference BehaviorRelay.accept in my unit tests. This doesn't seam to be a problem in my target code.
I got this errors when I refactored all my Variables -> BehaviorRelay
please let me know if I can help further and thank you for taking the time to look at this issue
m
@markGilchristBookingBug What are the steps for me to reproduce that behavior in a completely new project?
@kzaher
I have created a new project with the problem in
1) create new project adding rxSwift and RxCocoa
2) in the project create a struct
import Foundation
import RxCocoa
struct Stream {
static let flow = BehaviorRelay(value: 1)
}
3) then go to the unit tests and write a test like
func testStream() {
// arrange
Stream.flow.accept(2)
XCTFail()
}
4) this will recreate the error.
5) if you go to the Stream.swift as and check the test as a target membership the error will disappear. I cant see why it is not imported when using the @testable import .... I hope this helps
mark
@markGilchristBookingBug I was having a similar issue. Adding import RxCocoa and import RxSwift to my unit test file solved the linker build error.
@markGilchristBookingBug does @ebaker355 solution fixes your issue?
@kzaher @ebaker355 Thanks guys that does fix the problem! my test are running again
I did importing RxSwift and RxCocoa but I still get the linker error
Had same problem, but managed.
my steps:
installed pod RxCocoa. (added { pod 'RxCocoa', '~> 4.0' } to podfile)
imported RxCocoa in playground file code.
cleaned cache(cmd+shift+k)
run(still failed like agiokas mentioned in previous comment).
cleaned+build project.
build was succeeded and run after.
I had the same problem because I tried to call BehaviourRelay from the new Target (and I forgot to add the RxSwift and RxCocoa pods for it)
Everything was fixed when I added RxSwift and RxCocoa to the Podfile in new target.
```
def rx_pods
pod 'RxSwift'
pod 'RxCocoa'
end
target 'MyNewTarget' do
rx_pods
default_pods
end```
Most helpful comment
@markGilchristBookingBug I was having a similar issue. Adding
import RxCocoaandimport RxSwiftto my unit test file solved the linker build error.