I have an app that can successfully deploy to the simulator and a device, but when I attempt to run its associated UI tests, I am getting the following error:
MY_APP_TARGETUITests-Runner[55293:20696349] The bundle “MY_APP_TARGETUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
MY_APP_TARGETUITests-Runner[55293:20696349] (dlopen_preflight(/Users/@@@@/Library/Developer/Xcode/DerivedData/MY_APP_TARGET-gbamhqqrrbznxidxekwloacioddy/Build/Products/Debug-iphonesimulator/MY_APP_TARGETUITests-Runner.app/PlugIns/MY_APP_TARGETUITests.xctest/MY_APP_TARGETUITests): Library not loaded: @rpath/libswiftAVFoundation.dylib
Referenced from: /Users/@@@@/Library/Developer/Xcode/DerivedData/MY_APP_TARGET-gbamhqqrrbznxidxekwloacioddy/Build/Products/Debug-iphonesimulator/MY_APP_TARGETUITests-Runner.app/PlugIns/MY_APP_TARGETUITests.xctest/Frameworks/MyLocalPod.framework/MyLocalPod
Reason: image not found)
The first issue appears related to Library not loaded: @rpath/libswiftAVFoundation.dylib
, so I looked into that issue with the following:
dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
I performed the following items to attempt to resolve it:
- Removed and re-installed the affected pod
- Clean & rebuild
- Restart XCode & machine
- Delete derived data
- Added
s.framework = 'AVFoundation'
to the podspec file for my local pod - Set Always Embed Swift Standard Libraries to default (my pods now install without any warnings or errors)
None of these resolved the first error.
Regarding the second, I also checked here:
XCode10 - UITests - Reason: image not found
My Podfile
is set up like this:
use_frameworks!
inhibit_all_warnings!
platform :ios, '10.3'
def default_pods
pod 'RemotePod', '~> 1.0'
pod 'MyLocalPod', :path => 'path/to/MyLocalPod'
end
target 'MY_APP_TARGET' do
default_pods
end
target 'MY_APP_TARGETTests' do
inherit! :search_paths
default_pods
end
target 'MY_APP_TARGETUITests' do
inherit! :search_paths
default_pods
end
I have tested putting the pod directly into the target, but that did not change things.
Everything involved is 100% Swift, so there should not be any issues regarding mixing Objective-C.