31

Last night, the iPhone project was built perfectly.

This morning, I installed XCode 3.2.3 in a separate folder. When I open the same project in the old XCode 3.2.2 and re-built the project. I got this warning:

Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)

How can I fix it? Thanks!

ohho
  • 50,879
  • 75
  • 256
  • 383

13 Answers13

27

For me the following steps resolved the issue:

  1. Go to Product > Edit Scheme.

  2. Open the Archive Profile.

  3. Set Build configuration to Distribution.

benvolioT
  • 4,507
  • 2
  • 36
  • 30
Dim
  • 275
  • 3
  • 5
9

I've encountered the same problem too. It showed that I had a duplicate certificate registration in my keychains. Removing one of them (I removed the one from my system keychain) fixed the problem.

Steps that helped me to resolve my problem:

  1. Open KeyChain Access application
  2. Select the 'login' keychain, and select in the bottom pane 'Certificates'
  3. Switch to the 'system' keychain and see if there are certificates registered in both chains.
  4. Remove one of them
  5. Rebuild the application
JJM
  • 91
  • 1
  • 2
  • i had several certificates in different key-chains, leaving only one solved problem – RolandasR Oct 27 '10 at 12:21
  • Not the solution for me. I have no duplicates, but I do have the same symptoms. – neoneye Jan 10 '11 at 15:30
  • Solved it for me. Apparently, if you have an expired certificate still in Keychain, XCode will, for no good reason at all, use it instead of the newer non-expired one. – mrueg Jan 26 '11 at 02:01
6

I had the same problem, seems 3.2.3 messes with codesigning. I fixed it by re-running the 3.2.2 installer, no need to uninstall anything.

James J
  • 6,428
  • 6
  • 35
  • 45
  • To clarify a bit... does it mean: 1) `3.2.2` installed 2) install `3.2.3` 3) re-install `3.2.2`. After that, both `3.2.2` and `3.2.3` will work? – ohho May 23 '10 at 15:13
  • That's what I'm suggesting, yes. I can confirm being able to codesign for App Store (for OS 3.0 using 3.2.2). XCode 3.2.3 runs fine, but haven't tested out building/codesigning. – James J May 24 '10 at 22:04
  • Very radical, look at the solution below with much higher votes. – chewy May 18 '12 at 22:18
5

The parallel XCode problem can be addressed using the command line tool "xcode-select"

I found a similar problem caused by having XCode 4.2 beta installed. One of the embedded entitlements files was being placed in a different directory and was causing a file not found error.

The solution was to use xcode-select to verify and fix the XCode path.

tomwhipple
  • 2,850
  • 27
  • 28
  • 1
    Thanks! This command fixed the warning for me. XCode 4.0.2 was using the path to the beta version (XCode 4.2) when attempting to verify code signing. I set the path back with "xcode-select -switch /Developer". – Kim Aug 24 '11 at 09:11
  • I had both the 4.3 sdk and a beta of sdk5 running well for weeks but for some reason one day I could not create an ad hoc build without this error. And selecting back the 4.3 sdk with xcode-select finally worked, after hours of headaches. Many thanks! – romrom Sep 12 '11 at 09:05
  • 1
    Its probably worth saying here that 4.2 at the time of writing this cant be used to submit apps (in my case reports a code sign failure) – Luke Mcneice Sep 15 '11 at 21:30
4

Besides googling for possible solutions to this problem and trying them out (hoping that they help), here is an advice how to diagnose what causes this. The steps below apply to Xcode 4.2.

  1. In menu, select View > Navigators > Show Log Navigator. The Log Navigator should be displayed on the left side.
  2. In the list of builds, select the one that causes troubles. The log from the build will be shown in the main view.
  3. Scroll to the very bottom. The last two steps should be CodeSign and Validate, where the Validate step contains the warning.
  4. Expand CodeSign and inspect the parameters used to perform the code signing.
  5. Expand Validate to learn more about the errors/warnings.

Also scroll up and inspect the heading for the build target:

Build Target (your build target)

Project (your project) | Configuration (selected configuration) | Destination ...

In my case, I found out that while doing the Archive build, the app was signed with the developer certificate. Inspecting the heading for the build target revealed that the Release configuration was used to build the archive. The remedy was to:

  1. In the menu, select Product > Edit Scheme
  2. In the Edit Scheme dialog, select the Archive build item (list on the left)
  3. Change Build Configuration to Distribution

I had this issue after duplicating a build target. The original target was signed by the distribution certificate. However, when copying the target, Xcode decided to assign the Release configuration to the Archive build.

lumi77
  • 247
  • 2
  • 4
  • Thanks, this led me to realize that there SHOULD NOT be an Entitlements.plist file included for a Release target and Release project. After leaving these fields blank, the codeSign error went away. – JeffB6688 Dec 20 '11 at 23:40
3

This happened to me today as I was moving an existing project into a new Git repository structure, while simultaneously using a development certificate obtained via being added to my client's team as a "Member". So lots of opportunity for things to screw up.

In my case, the issue turned out to be the "Build Products Path". I had it set to the relative path "../../../build" instead of an absolute path. This was causing the Validate tool to screw up since the actual path wasn't being collapsed properly. I changed it to an absolute path and the Validate tool then began to run successfully once more.

I submitted this as a bug to Radar as #8946204.

Shaggy Frog
  • 27,575
  • 16
  • 91
  • 128
  • I know this is an old post but @Shaggy Frog's solution was exactly what I discovered to be my problem too. In my "Build Products Path" for the project's settings I had the following value $(PROJECT_DIR)/../build. The reason I did this is I did not want the build folder to be in the same folder as my project (for source control reasons). The "../" caused the code-signing warning that ohho has in the original question. After I removed the "../" from my build path the code-signing warning went away. My Answer: Do not use "../" in your build path. –  Apr 13 '11 at 18:20
  • Yup, same in my case - the build path containing .. was the issue. Needless to say this is frustrating since it makes it hard to move the project around between machines with different build output. – Sagi Mann Jul 10 '11 at 14:11
3

This is kind of an old post but I wanted to share what I learned (really remembered because I forgot this part.) I was trying to build my project against an ad-hock profile. I had forgotten that I needed to create a separate App Store profile (Provisioning Portal -> Provisioning -> Distribution). This was my first app I've submitted and the documentation is overwhelming so I missed/forgot about this part. Once I created the App Store profile and installed in XCode everything worked fine. Just wanted to throw this out there in case anyone else has this same issue.

Merky
  • 494
  • 2
  • 4
3

Due to what hiroshi said you can change it there: I just do is:

  • Open the Organizer
  • Go to Devices
  • Provisioning Profile
  • Click on the Profile you want to use. There you will see the profile identifier key.
  • Open the xcode project via textfile (the file in the xcodepj bundle)
  • Go to those lines and put the key in here
@@ -325,6 +325,7 @@
                            PREBINDING = NO;
 +                               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "key goes        here";
                            SDKROOT = iphoneos;
 @@ -361,6 +362,7 @@
                            PREBINDING = NO;
 +                               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "and also here";
                            SDKROOT = iphoneos;
  • Save changes and restart the Project

!!!That's what worked for me in XCODE 4!!!

Arndt Bieberstein
  • 1,128
  • 1
  • 14
  • 28
0

If you go to the Organizer and select Provisioning Profiles, is the profile listed there? If so, have you checked that it's setting in the Project Settings/Build/Code Signing section?

Ben Williams
  • 4,695
  • 9
  • 47
  • 72
  • 1
    Yes. Yes. I also found that this warning shows up on every old projects. It seems to me 3.1.3 some what alters the 3.1.2 environment... – ohho May 21 '10 at 08:26
0

I'm not sure, but reverting those changes in the project.pbxproj rescues me from failing to start my app in devices. The warning subject of the question remain though.

@@ -325,6 +325,7 @@
                                PREBINDING = NO;
+                               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
                                SDKROOT = iphoneos;
@@ -361,6 +362,7 @@
                                PREBINDING = NO;
+                               "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
                                SDKROOT = iphoneos;
hiroshi
  • 6,871
  • 3
  • 46
  • 59
0

I fixed this simply by deleting my distribution certificate from keychain then downloading it again from the provisional profile

Ayub
  • 110
  • 1
  • 1
  • 6
0

For the build warning or archive validation error "Application failed codesign verification", see Apple's complete list of potential causes at the following URL "How do I resolve the error: Application failed codesign verification?"

Best,

Bobjt
  • 4,040
  • 1
  • 29
  • 29
-1

Simple Solution: Build your app using a DISTRIBUTION certificate and not a Developer cert.

ubert
  • 121
  • 2
  • 1
    This worked for me. Xcode 4, build settings, code signing identity, release, change the certificate from the developer to the distribution, both target and project. Note this was when doing a project, archive (in order to submit an archive to the appstore). – Jack BeNimble Oct 10 '11 at 21:37