I'm developing a cocoa touch framework and I'm importing "RealmSwift" using CocoaPods. The project builds successfully but the tests fails to load. I'm getting the following error:
xctest (97035) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying error: The test runner failed to load the test bundle. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch.))
Crash log:
2019-02-27 17:35:44.197599+0400 xctest[12408:121075] The bundle “MyFrameworkTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2019-02-27 17:35:44.197835+0400 xctest[12408:121075] (dlopen_preflight(/Users/zakaria/Library/Developer/Xcode/DerivedData/MyFramework-cltpexonmtkefveximwygxbkkcrj/Build/Products/Debug-iphonesimulator/MyFrameworkTests.xctest/MyFrameworkTests): Library not loaded: @rpath/Realm.framework/Realm
Referenced from: /Users/zakaria/Library/Developer/Xcode/DerivedData/MyFramework-cltpexonmtkefveximwygxbkkcrj/Build/Products/Debug-iphonesimulator/MyFrameworkTests.xctest/MyFrameworkTests
Reason: image not found)
I tried every solution I could find online, but to no avail.
It's worth mentioning that this works successfully in a iOS project, the problem occurs only in a cocoa touch framework.
My podfile is as follow:
target 'Framework' do
use_frameworks!
pod 'RealmSwift', '~> 3.13.1'
target 'FrameworkTests' do
inherit! :search_paths
end
end
I'm using Xcode version: 10.1 and CocoaPods version: 1.6.0
Go to your test logs in Derived data folder:
~/Library/Developer/Xcode/DerivedData/APP_BUILD_FOLDER/Logs/Test
You will find a .xcresult
test result bundle, right-click it and choose Show package contents
and in 1_Test/Diagnostics
folder, you should find run/crash log for your tests.
This log will give you an exact cause of your fail, you can post it here if you don't know what to do with it after you find it, we will help you :-)
Without this log, cause of your issue could be literally anything, since this is rather generic xcbuild fail message.
This is the podfile that worked for me:
platform :ios, '11.0'
def shared
use_frameworks!
pod 'RealmSwift', '~> 3.18.0'
end
target 'Framework' do
shared
end
target 'FrameworkTests' do
shared
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With