RxSwift: 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.
Suggestions?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 12
- Comments: 34 (19 by maintainers)
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
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.
Before:
After:
I hope this can help.
@schroepf Same for me. Tests run on iOS 13 simulator, but fail on everything older than that.
I am using XCode 12.4
I tried everything above, but when I changed from app to test target, the problem finish.
I finally found a solution for this issue. Turns out that it’s an Apple bug. Anybody thats looking for a fix should reference this gist: https://gist.github.com/liamnichols/3507faf70ecca201cb4300645caa9b74
Just swap out your simulator version and you should be good to go.
@muehlemann I just removed the xcconfig files and add the custom configurations as user defined build configs directly to the project (which is equivalent if you have just one project).