Today I downloaded Xcode 9 and made the necessary changes for my application to compile. The application is compiling and running locally without any issues.
Using Xcode
I too got same error from Xcode 9.1 even though I have updated Carthage to latest version https://github.com/Carthage/Carthage/releases I have failed in uploading build to iTunes
Worked for me this way:-
If you have updated your Xcode to 9.1 then
Update your carthage.pkg
downloading from https://github.com/Carthage/Carthage/releases
Install .pkg
and
Give carthage update
command in Terminal
by referring to your project
and
then go to you project Build Settings
find Enable Code Coverage Support
change that setting from Yes
to No
Then Archive and upload to AppStore
. You build will be ready
. Happy
!
The solution to automate setting code coverage to false for all dependencies is to run the following command on terminal (please go to the directory of your project):
grep -lR "codeCoverageEnabled" --include *.xcscheme --null Carthage | xargs -0 sed -i '' -e 's/codeCoverageEnabled = "YES"/codeCoverageEnabled = "NO"/g'
This will set code coverage to NO and iTunes connect will not complain.
The sequence to make everything work is the following
carthage update --platform iOS --no-use-binaries --no-build
. This will update and download all dependecies.
When Carthage start to compile you can press ctrl+c to cancel. carthage build --platform iOS
. This will build everything with code coverage to NOYou can now archive and upload to iTC.
The command was given by https://github.com/gunterhager, so credit goes to him
As an alternative for fastlane users, add the following to your fastlane file, which will automate everything:
desc "Update Carthage"
lane :update_carthage do
carthage(
command: "update", # One of: build, bootstrap, update, archive. (default: bootstrap)
use_binaries: false, # Check out dependency repositories even when prebuilt frameworks exist
no_build: true, # When bootstrapping Carthage do not build
platform: "iOS" # Define which platform to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS‘, or comma-separated values of the formers except for ‘all’)
)
sh("grep -lR 'codeCoverageEnabled' --include *.xcscheme --null Carthage | xargs -0 sed -i '' -e 's/codeCoverageEnabled = 'YES'/codeCoverageEnabled = 'NO'/g'")
carthage(
command: "build", # One of: build, bootstrap, update, archive. (default: bootstrap)
platform: "iOS" # Define which platform to build for (one of ‘all’, ‘Mac’, ‘iOS’, ‘watchOS’, ‘tvOS‘, or comma-separated values of the formers except for ‘all’)
)
end
As quick fix, run these commands in Terminal (be sure to go to your project's root folder):
carthage update --platform iOS --no-use-binaries --no-build
This will update your dependencies, but will build nothing.
grep -lR "codeCoverageEnabled" --include *.xcscheme --null Carthage | xargs -0 sed -i '' -e 's/codeCoverageEnabled = "YES"/codeCoverageEnabled = "NO"/g'
This will set code coverage to NO
.
carthage build --platform iOS
This will finally build all frameworks without code coverage.
Now you can archive your project and upload it to iTunes Connect.
The nice people at the Carthage
project are already working on a more user friendly fix, so be sure to check for releases there.
Just update Carthage
to version 0.26.0
or higher and then run the carthage update
command again.