I have an Xcode project that does not seem to want to compile my main app target to generate a product prior to attempting to use it as the application host when running unit tests. From Xcode, I am attempting to run unit tests with ⌘ + U
.
I immediately get a dialog which states:
Could not determine bundle identifier for [app name] TEST_HOST
(Replace [app name] with the real application name)
This dialog also includes a path to my local derived data products directory:
"/Users/***/Library/Developer/Xcode/DerivedData/Lowes-aymgdtrbrarmcidtkxoqxeafmxmj/Build/Products/Debug-iphonesimulator/[app name]"
I have unit tests set up with the TEST_HOST setting pointing to $(BUILT_PRODUCTS_DIR)/[app name].app/[app name]
. The unit test target has a target dependency on the main app target. The BUNDLE_LOADER setting is set to $(TEST_HOST)
. If I compile the main app target first by hitting ⌘ + B
, the correct directory structure and app are created, and then hitting ⌘ + U
bootstraps and runs the unit tests correctly. If I do a clean and try again it immediately fails. I have never run into this issue before, and it seems to have sprung up after the app was converted to Swift 3. This may or may not have any bearing on the problem, not really sure.
I have read through several answers here and tried a lot of the suggestions, but they don't seem to have the same root problem as me. For most people, it seems setting the host application to None and back to the main target fixes the issue. This is not the case for me.
I've tried fresh checkouts, re-converting the app and test targets to Swift 3, and also the standard clean / clean build folder / wipe derived data. None of these seem to have any effect.
Has anyone else experienced this issue and figured out a solution?
I found a resolution for this. It might not apply to every scenario, but it fixed mine. In the main project settings on the Info tab, there is an option to select the configuration to run when starting command line builds. Mine was set to Release. Flipping this to Debug fixed my issue.
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