I want to start tests under Xcode 8 and it fail in the beginning. My error is:
Could not determine bundle identifier for MyProjectTest's TEST_HOST: "/Users/jakubmazur/Library/Developer/Xcode/DerivedData/MyProject-ejeepybggxvekxajlyngopeahiex/Build/Intermediates/CodeCoverage/Products/Testing-iphonesimulator/MyProject.app"
Any idea what's wrong here? I try to clean project - nothing.
In the Build Settings
in my target in Packaging
i change Product Bundle Identifier depends on configuration in my schema. It can have something to do with that, but not sure.
-- EDIT
Ok figure how to narrow the problem. When i change settings in scheme to use Build Configuration Debug
instead of Testing
seems to work, but I need separate configuration for testing.
For some reason the "Host Application" setting in the picture below was the problem for me. Selecting the proper target fixed this.
This ended up modifying the following values in my xcodeproj:
There is one more case you might encounter. If you need different product names for main target(for example Debug, Staging, Production) - and try to use Xcode Host Application selector, it will write incorrect values to TEST_HOST build setting.
And while error message you see is about bundle identifier in Debug configuration, Xcode actually complains about TEST_HOST in Release configuration.
I fixed it by manually changing TEST_HOST build setting. For example, if you have ProductName on main target set to AppDebug in Debug and AppRelease in Release configuration, your TEST_HOST should be following:
What Xcode sets:
$(BUILT_PRODUCTS_DIR)/AppDebug.app/AppDebug
What you need to set:
Debug configuration: $(BUILT_PRODUCTS_DIR)/AppDebug.app/AppDebug
Release configuration: $(BUILT_PRODUCTS_DIR)/AppRelease.app/AppRelease
My project has many targets so I had to set the Tests Target's Host Application to 'None'. (Xcode 9.2)
Ok figure it out. There is a problem with naming packages. Unfortunatelly there is some issue with Xcode. I was using different Module Names for different Configurations. So go to Project
-> Build Settings
-> Product Module Name
Change name in all configurations for same name without spaces.
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