Closed omichde closed 3 years ago
Hi @omichde,
the issue you are facing is caused by a bug in SPM (SR-12303). There have been several discussions and approaches to work around that limitation (e.g. 2127).
For your example project I quickly applied one suggestion posted by @freak4pc and verified it works with Xcode 12.4 and 12.5b3:
The basic idea here is to import the Rx dependencies in a local package which defines separate targets for the application and the test targets.
This approach is not guaranteed to work in more complex project setups but should illustrate the underlying idea of how a potential workaround could look like until the root cause gets fixed.
Hi @esstheevau ,
this is amazing news as this was a blocker for weeks now. I'll try out and see how you've set up the different targets - thank you already...
Hm, after some progress while compiling and linking, our production app itself is running fine but the tests spits out lots of warning about possible duplicate symbols and later on crashes.
The warning first:
objc[20139]: Class _TtC7RxSwiftP33_AB3B9E8806A71B46FB498A7594F5E0D919AnonymousDisposable is implemented in both .../Debug-iphonesimulator/PackageFrameworks/RxLibraries.framework/RxLibraries (0x10a33be48) and .../Debug-iphonesimulator/PackageFrameworks/RxTestLibraries.framework/RxTestLibraries (0x10b90edf8). One of the two will be used. Which one is undefined.
And the crash in particular:
Test Case '-[... test_canNotSendMail_shouldHide_OpenMailButton]' started. failed to demangle superclass of MapSink from mangled name ']>' 2021-03-29 18:41:44.878892+0200 BahnX[20139:412407] failed to demangle superclass of MapSink from mangled name '\^B]>\^B' failed to demangle superclass of MapSink from mangled name ']>' CoreSimulator 757.3 - Device: iPhone 8...
Yes, this is the next issue I've ran into as well. Some more insights can be found here.
Seems like when integrating the Rx dependencies into multiple modules this will be inevitable and unfortunately this is what also stops me from continuing migrating my main project to SPM right now.
The workaround looked rather promising at first but so far I couldn't find a way to resolve the duplications, spent the better part of today on this already...
OK, we tried hard - thanks again for your help so far. Maybe the next Xcode version might contain a surprise on that for us. For the time being, we're stuck too...
Xcode 12.5 RC 1 appears to have resolved this issue for me
Xcode 12.5 RC 1 appears to have resolved this issue for me
Indeed, the 12.5 RC 1 fixes the issue - thank you all
Short description of the issue:
While using RxSwift in an iOS app and using SwiftPM, we fail to use RxTest in our tests via cmd-u
Note
This may be an Xcode shortcoming but I want to make sure that I did not do something wrong from a setup perspective. And as this is the default/future/modern way to setup projects I was wondering why it so easily fails (again no fingerpointing, just wondering) and what could be done to solve these problems.
The test dependencies to RxTest (and hence RxSwift) will lead to RxSwift being linked twice and hence the error in Xcode 12.4:
As we heard this improved in Xcode 12.5 beta 3 we tried it out and it failed now with a code signing error:
Expected outcome:
What actually happens:
Self contained code example that reproduces the issue:
See sample project as attachment…
test.zip
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
6.1
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
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)