Test target X encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted
Solution 1:
I have my notes and demo applications for both Cocoapods and Carthage here https://github.com/onmyway133/TestTarget
- Make sure all frameworks are linked to the Test targets
- Configure
Runpath Search Paths
to point to$(FRAMEWORK_SEARCH_PATHS)
More info
- Run-Path Dependent Libraries
Solution 2:
I'm using carthage and problem for me was searching for dependencies in a test target. Fix:
Add $(PROJECT_DIR)/Carthage/Build/iOS
to Runpath Search Paths
You can find reference here: Carthage issue
Solution 3:
There might another solution, if you are using CocoaPods and the UI test target is embedded inside the app target, which is, unfortunately, the case in the default template (pod init
).
Try move the UI test target out of the app target as follows:
from:
platform :ios, '11.0'
use_frameworks!
target 'MyApp' do
# Pods for MyApp
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
to:
platform :ios, '11.0'
use_frameworks!
# Pods shared between MyApp and MyAppUITests
target 'MyApp' do
# Pods for MyApp only
end
target 'MyAppUITests' do
# Pods for testing
end
Credit goes to SpacyRicochet in this issue thread: https://github.com/CocoaPods/CocoaPods/issues/4752#issuecomment-305101269
Solution 4:
My solution was to add a "Copy File phase" to my test target. There I set destination to Frameworks and added my framework with the + sign.
Solution 5:
In my case there was nothing wrong with linked files. The Simulator was kind of stuck at the message that the app triggered, like: "App name would like to send you notifications". Pressed OK and the next time my XCTests worked fine.