How to solve "Application failed codesign verification" when uploading to iTunes Connect?

56,129

Solution 1

I found the solution to this problem after deeply looking at the log file.

Although I created my own Distribution Profile and assigned to the CODE SIGNING IDENTITY the correct value for the developer certificate, it didn't work giving me an error: "Application failed codesign verification".

The problem is at the following line:

Authority=iPhone Developer: My Name (XXXXXXXXX)

Despite the correct selection in the project settings for the Distribution profile, XCode was compiling it with the developer certificate.

I finally solved it: Right click on the "Targets" -> Get info -> and there it was selected (don't ask me why) the wrong distribution certificate instead of the right one.

I corrected that and it finally was accepted.

Related links (you need a developer account): https://devforums.apple.com/message/147964

Solution 2

Excellent post. I too was having this trouble and after much headache realized that both the Project AND the Target should be checked for using the correct Code Signing Identity. Somehow Xcode was reverting back to the Developer Provisioning Profile instead of the Distribution Provisioning Profile. It even did so on a build right after I had deliberately selected the correct one!

I. To be safe, first do the following:

  1. Clean all builds.
  2. Delete contents of build folder in finder.
  3. Delete existing code signing identities from the project and target settings.
  4. Restart Xcode.

II. Then check the Project for the correct Provisioning Profile:

  1. Go to Project Settings > Build Tab > Code Signing Identity
  2. Select the appropriate Distribution Provisioning Profile

III. Now check the Target:

  1. Target > Get Info > Build Tab > Code Signing Identity
  2. Select the appropriate Distribution Provisioning Profile

IV. Cross fingers and hope you never see that blasted little yellow triangle again.

Solution 3

Cy took the right approach for solving this problem - When "Application failed codesign verification" is a build warning, expand that item in the build log and scan for the root cause of the failed signature verification.

In the case of Cy.'s original post you'll see that the root issue was "test-requirement: failed to satisfy code requirement(s)", and in my experience this is almost always caused by signing with the wrong certificate i.e. an iPhone Developer profile instead of iPhone Distribution.

The root cause is not always an obvious explanation, but should guide you at least with additional search terms or troubleshooting ideas.

For others experiencing the "Application failed codesign verification" during Xcode Archive Validation or Submission, look to the build log at Product > Archive time for a build warning by the same title and expand that for the root cause. Then take a look at Apple's complete list of potential causes of this error at the following URL "How do I resolve the error: Application failed codesign verification?"

Solution 4

Check that the TARGET (and not only the Project) is setup with the correct Code Signing Identity for Release

Share:
56,129
Cy.
Author by

Cy.

Updated on July 09, 2022

Comments

  • Cy.
    Cy. almost 2 years

    I've got a problem that I couldn't solve with a deep search in different resources as most of the "similar" points out to be an error with Icon.png size, etc...

    I've tried to upload my application after verifying that:

    • Correctly builds and run on my device
    • That my certificates are installed properly
    • That my certs / profiles are not expired.
    • That the Icon.png has the proper size and format of 57x57 PNG.
    • And several other things.
    • Ran codesign --verify -vvvv MyApp.app which worked fine.
    • My ZIP File was properly done

    When I've tried to upload through the iTunes connect interface I got the simple error above, and that's why I tried with ApplicationLoader, to try and find out what's causing the error looking at the console.

    The console showed the following:

    16/02/10 13:25:52   ApplicationLoader[549]  *** Codesign error (please ignore invalid option comments): got requirements(0x800000, 534)
    Executable=/var/folders/WZ/WZu24JnOGNe9L79GWq0IlU+++TI/-Tmp-/MyApp.zip/MyApp.app/MyApp
    Identifier=com.realtimed.MyApp
    Format=bundle with Mach-O thin (armv6)
    CodeDirectory v=20100 size=829 flags=0x0(none) hashes=33+5 location=embedded
    Signature size=4333
    Authority=iPhone Developer: My Name (XXXXXXXXX)
    Authority=Apple Worldwide Developer Relations Certification Authority
    Authority=Apple Root CA
    Signed Time=16/02/2010 13:22:24
    Info.plist entries=17
    Sealed Resources rules=3 files=28
    Internal requirements count=1 size=144
    
    Executable=/var/folders/WZ/WZu24JnOGNe9L79GWq0IlU+++TI/-Tmp-/MyApp.zip/MyApp.app/MyApp
    got entitlements(0x800400, 317)
    codesign_wrapper-0.7.3: using Apple CA for profile evaluation
    codesign_wrapper-0.7.3: Caling codesign with the following args:
    codesign_wrapper-0.7.3:    /usr/bin/codesign
    codesign_wrapper-0.7.3:    --verify
    codesign_wrapper-0.7.3:    -vvvv
    codesign_wrapper-0.7.3:    -R=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and certificate leaf[field.1.2.840.113635.100.6.1.4] exists
    codesign_wrapper-0.7.3:    --entitlements
    codesign_wrapper-0.7.3:    /var/tmp/signingbox/codesign_wrapper_entitlements.plist
    codesign_wrapper-0.7.3:    /var/folders/WZ/WZu24JnOGNe9L79GWq0IlU+++TI/-Tmp-/MyApp.zip/MyApp.app
    **/var/folders/WZ/WZu24JnOGNe9L79GWq0IlU+++TI/-Tmp-/MyApp.zip/MyApp.app: valid on disk
    /var/folders/WZ/WZu24JnOGNe9L79GWq0IlU+++TI/-Tmp-/MyApp.zip/MyApp.app: satisfies its Designated Requirement
    test-requirement: failed to satisfy code requirement(s)
    codesign_wrapper-0.7.3: failed to execute codesign(1)**
    

    Any help / feedback or ideas on how to solve the situation would be highly appreciated.