Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9, Carthage. iTunes Connect Error: "Invalid Bundle - Disallowed LLVM instrumentation"

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 9 I uploaded it to the App Store. Upload was successful without any errors.

I then go the following email from Apple:

Dear developer,

We have discovered one or more issues with your recent delivery for "KiteSpotter - Kitesurf wind and weather forecast". To process your delivery, the following issues must be corrected:

Invalid Bundle - Disallowed LLVM instrumentation. Do not submit apps with LLVM profiling instrumentation or coverage collection enabled. Turn off LLVM profiling or code coverage, rebuild your app and resubmit the app.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

I went and turned off code coverage for both my target and cocoa pods target, which was the only relevant setting I could find:

enter image description here

Resubmitted the application and I am getting the same error.

On my project I am using Carthage, which has more than 15 dependencies. Searching for a solution I found that all projects need to be updated with the above setting.

  • Is there any solution to automate this setting for all frameworks, if that is causing the problem.
  • Has anyone else faced this problem and sorted it out. Were the Carthage frameworks creating the issue or something else?
like image 297
zirinisp Avatar asked Sep 11 '17 16:09

zirinisp


4 Answers

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

  • Run 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.
  • Run the above command to set code coverage to NO
  • Now that everything is into place run carthage build --platform iOS. This will build everything with code coverage to NO

You 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
like image 71
zirinisp Avatar answered Oct 22 '22 09:10

zirinisp


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.

like image 28
Gunter Hager Avatar answered Oct 22 '22 10:10

Gunter Hager


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

enter image description here

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

enter image description here

Then Archive and upload to AppStore. You build will be ready. Happy!

enter image description here

like image 3
Sanju Avatar answered Oct 22 '22 09:10

Sanju


Just update Carthage to version 0.26.0 or higher and then run the carthage update command again.

like image 2
arturgrigor Avatar answered Oct 22 '22 11:10

arturgrigor