SolvedRxSwift RxTest referencing to invalid libswiftXCTest.dylib

Hello everyone, I was wondering if someone here had my same issue.

I have an iOS project in which there are multiple modules. each module has its own test bundle.
Tests run perfectly until I install via cocoa pods RxTest.

After install, test bundles crash with the following message in console:

2019-09-25 17:46:29.756701+0100 xctest[70947:11876875] The bundle “MyModuleTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2019-09-25 17:46:29.756838+0100 xctest[70947:11876875] (dlopen_preflight(/Users/.../Library/Developer/Xcode/DerivedData/.../Products/Debug-Dev-iphonesimulator/MyModuleTests.xctest/MyModuleTests): Library not loaded: /usr/lib/swift/libswiftXCTest.dylib
Referenced from: /Users/.../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug-Dev-iphonesimulator/MyModuleTests.xctest/MyModuleTests/RxTest.framework/RxTest
Reason: no suitable image found. Did find:
/usr/lib/swift/libswiftXCTest.dylib: mach-o, but not built for iOS simulator)
Program ended with exit code: 9

I checked already the usual suspects: The run path searchPath is $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'as it should be.

I tried for quite a lot of time to get this to work playing with build configurations, but all without any success. If I remove RxTest, everything goes back to normal and tests start running again.


34 Answers

✔️Accepted Answer

I noticed the same issue. But it seems that I can run the tests from XCode 11 on the iOS 13 simulator. But when I try to run them on a simulator with an older iOS version (in my case iOS 11.4) I see that exact same errors as you do

Other Answers:

I solved the same issue in my project by switching everything to Swift 5 and adding a line of code in the podspec that requires XCTest.


  s.frameworks = 'XCTest', 'XCTAutomationSupport'
  s.xcconfig = {
    'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks"',
    'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks"'


  s.frameworks = 'XCTest', 'XCTAutomationSupport'
  s.xcconfig = {
    'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift-$(SWIFT_VERSION)/$(PLATFORM_NAME) $(inherited)',
    'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks"',
    'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/PrivateFrameworks"'

I hope this can help.

@schroepf Same for me. Tests run on iOS 13 simulator, but fail on everything older than that.

Related Issues:

RxSwift What is the correct way to handle errors?
I got an answer from the conversation with @kzaher on Slack Hi I'm almost new to Rx and trying to un...
RxSwift Cannot flatMap a Single trait to a Completable trait
I absolutely agree with @tarunon I encounter that situation almost every day Currently I implement t...
RxSwift UITextView.rx_text observe programmatic text changes.
Hi @tarunon this does not work because it's not a control event I found a my unintended behavior in ...
RxSwift Revisit typed errors?
It looks like Swift 5 introduces Result<Value Error: Swift.Error> This thing compiles: but it would ...
RxSwift Error when using package manager in Xcode 11.4 beta
@freak4pc Yes for my project it work great In build settings for main app in chapter build options I...
RxSwift Maybe delegate was already set in xib or storyboard and now it's being overwritten in code.
Hi guys! I don't think it a problem of Cocoapods Most likely you are using bindTo(tableView ...
RxSwift RxTest referencing to invalid libswiftXCTest.dylib
I noticed the same issue But it seems that I can run the tests from XCode 11 on the iOS 13 simulator...
jsonnet [Website] Interactive tutorial - "TypeError: Module.UTF8ToString is not a function"
FYI it can be fixed with the following bookmarklet: Usable as an interim solution for playing around...
react native keychain SDK Build Tools revision (23.0.1) is too low for project :react-native-keychain.
Ok I found a solution to this For people facing the same problem in the future Hey there ...
expo Error: fsevents unavailable (this watcher can only be used on Darwin)
Possible solution: I had installed watchman via npm install -g watchman but apparently this installs...
CocoaPods [error report] pod install /w m1 macbook
do you have a MacBook Pro with a M1 processor? this fixed my issue: Report What did you do? Run pod ...
flutter Multiple commands produce '/build/ios/Debug-iphonesimulator/
I was able to fix it by opening the Runner workspace project in Xcode 10 Then navigate to File ...
flutter App Store iOS submission fails: The bundle does not support the minimum OS Version specified in the Info.plist
After doing a flutter clean changing MinimumOSVersion (inside /ios/Flutter/AppframeworkInfo.plist) t...
flutter '' has different version for the compile (26.1.0) and runtime (27.0.1) classpath
is like this i receive an error when i run flutter run My file is: flutter doctor: ...
flutter Why does my text not wrap?
You have to wrap Column in a flexible Without flexible the column's width is not constrained to the ...
CocoaPods NoMethodError - undefined method `size' for nil:NilClass
Also faced with this issue Fixed by updating flutter and cocoa pods to the latest version and then ...
flutter Unexpected top padding in ListView put inside scaffold with no appBar
Yeah this is intentional If you put a widget before the ListView you should wrap the ListView with a...
flutter Missing xcode dependency: Python module "six"
try python2.x -m pip install six by @humblerookie's suggest or brew reinstall python@2 pip install s...
expo exp build:android fails
This works exp start Cancel ctrl c then do exp build:android. Running exp build:android errors fails...
flutter flutter messaging: set the notification icon
Hey guys I fought with this for the better part of a day For some strange reason there are no tutori...
flutter Issue with cloud_firestore - Cannot fit requested classes in a single dex file.
As a workaround you can try enabling mutlidex for Android App by following Enable multidex for apps ...
flutter D8: Program type already present: io.flutter.BuildConfig
@smrucv I received the same error but after flutter clean and flutter packages get everything works ...
CocoaPods pod install has bug
Did you try: sudo arch -x86_64 gem install ffi And run: arch -x86_64 pod install instead of pod inst...
sheetjs How to simply export a Worksheet to xlsx?
There are two issues: each object is mapped to a row so if you want a row with name John and city Se...
flutter Introduction of characters package causes crash on flutter run for preexisting Flutter applications
In my case I resolved the issue with flutter clean After e0ed12c I get this error when building: @ju...
nativescript cli TNS doctor doesn't recognize Xcode (High Sierra)
HI @philipfeldmann Can yhou please run xcodebuild -version and paste the output? May be Xcode is ins...
flutter Making Network http error SocketException: Failed host lookup
@hoc081098 Double-check / make sure you have <uses-permission android:name=android.permission.INTERN...
flutter Support inlining Android/iOS views
iOS view embedding support has landed on master This is still just a preview There are multiple open...
flutter ✗ Android license status unknown.
Hi everyone Steps to Reproduce Please tell us what you were doing and what went wrong If you are run...
react native mapbox gl No static method toHumanReadableAscii
here is workaround: build.gradle got the following error on runtime: java.lang.NoSuchMethodError: No...
CocoaPods CocoaPods was not able to update the master repo
Looks like your specs repo was edited at some point and now git can't update it ...
flutter idevice_id cannot run on catalina
When you're developing on Catalina Steps to Reproduce Run flutter doctor on macOS Catalina I get the...
CocoaPods CocoaPods compatibility with Apple DTK (Apple Silicon)
For anyone else struggling with this issue I just found a way to solve it In addition to running ter...
flutter type 'List<dynamic>' is not a subtype of type 'List<String>'
The problem is your fromMap constructor is reading from a Map<String dynamic> ...
flutter TextField is hidden by keyboard inside of a Modal Bottom Sheet
This may not work for all situations but I have a modalBottomSheet that contains only a TextField ...
CocoaPods Build issue with Xcode 12.3 - file not found #include "ruby/config.h"
I just updated to Xcode 12.3 and I am hitting this issue Seems like Xcode 12.3 broke the system ruby...
CocoaPods Unzip fail when zip contains chinese char on macOS 10.13
Maybe replace unzip with ditto: I have a SDK and there is a folder named FaceDistortion_20171205雪天的雪...
NativeBase Needs to tap twice to fire onPress function when keyboard is open
@bm-software Use keyboardShouldPersistTaps={'handled'} and will works fine. react-native ...
CocoaPods None of your spec sources contain a spec satisfying the dependencies
Did you note this part of the error message: Note: as of CocoaPods 1.0 pod repo update does not happ...
react native firebase 🔥(Android) Program type already present: io.invertase.firebase.BuildConfig
I think I found my ultimate error here In my package.json file I had at some point earlier ...
flutter Dismissing keyboard programatically
This is a better way as it also clears the focus: FocusScope.of(context).requestFocus(new FocusNode(...
flutter How to solve: Android license status unknown and also Android sdkmanager tool not found? Tried everything(as i think)
The answer is here Uncheck Hide Obsolete Packages and you'll see Android SDK Tools (Obsolete) 26.1.1...
flutter MissingPluginException: No implementation found for method
@mravn-google Yeah turned out I had to quit the flutter run process and start it up again Just a ful...
flutter firebase_auth: ^0.8.0+1 crashes on Android
Here i put this in file: android/ and changed targetSdkVersion to 28 and it worked...