dipak
dipak

Reputation: 135

Command /usr/bin/codesign failed with exit code 1

CodeSign "build/Release-iphoneos/Nice Saying123.app"
cd "/Users/c28/Documents/Office Projects/Nice Saying123"
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv _CODESIGN_ALLOCATE_ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/usr/bin/codesign -f -s "iPhone Developer: dipak kasabwala (29QJU3WV6X)" "--resource-rules=/Users/c28/Documents/Office Projects/Nice Saying123/build/Release-iphoneos/Nice Saying123.app/ResourceRules.plist" --entitlements "/Users/c28/Documents/Office Projects/Nice Saying123/build/Nice Saying123.build/Release-iphoneos/Nice Saying123.build/Nice Saying123.xcent" "/Users/c28/Documents/Office Projects/Nice Saying123/build/Release-iphoneos/Nice Saying123.app"

/Users/c28/Documents/Office Projects/Nice Saying123/build/Release-iphoneos/Nice Saying123.app: replacing invalid existing signature
/Users/c28/Documents/Office Projects/Nice Saying123/build/Release-iphoneos/Nice Saying123.app: CSSMERR_TP_NOT_TRUSTED
Command /usr/bin/codesign failed with exit code 1

Upvotes: 5

Views: 6814

Answers (6)

Fouad
Fouad

Reputation: 855

In my case it was the "iPhone Developer" certificate which was marked as "Always Trust". After switching to "System Defaults" it works like a charm! :-)

I also was able to make it work by selecting "System Defaults"

Upvotes: 0

plm
plm

Reputation: 198

This occurred for me after another certificate was added to my keychain.

This is a senseless fix, but having tried everything, I unlocked/locked the login keychain and everything was fixed.

hmmmm.

Upvotes: 0

Nate
Nate

Reputation: 31045

I had the exact same error, and tried everything under the sun, including what was on the discussions.apple.com link above. What the problem was for me was that in Keychain Access, the actual Apple WWDR certificate was marked as "Always Trust". It needed to be "System Defaults". That goes for your Development and Distribution certificates, too. If any of them are incorrectly set to "Always Trust", that can apparently cause this problem.

So, in Keychain Access, click on the Apple Worldwide Developer Relations Certificate Authority certificate, select Get Info. Then, expand the Trust settings, and for the combo box for "When using this certificate:", choose "System Defaults".

It's very confusing that selecting "Always Trust" produces an error claiming that something is not trusted :( ... but that's the way it is apparently!

Hattip to @MariaZverina, whose comment/link provided help on this issue.

Edit: you may need to check both Login and System certificates, looking for this problem.

Upvotes: 17

Donald Burr
Donald Burr

Reputation: 2281

In my case, it turned out to be because neither of the necessary intermediate certificates were installed (Apple WWDR and Developer ID). I just set up a new computer and exported my developer profile from my old machine, which bundles up all of the necessary certificates, keys, provisioning profiles, etc. into a single file, making a neat little package that can be backed up, or in my case, easily moved to a new machine. Unfortunately I had assumed that the intermediate certs would come along for the ride. They didn't. Downloading the intermediate certificates from the Apple developer site and installing those using Keychain Access did the trick.

Note there are two intermediate certificates: the Apple WWDR Intermediate Certificate (which covers both iOS and Mac App Store development and distribution), but there is also a separate Developer ID Intermediate Certificate (which covers Developer IDs, e.g. distributing outside of the App Store).

Upvotes: 0

darkmystel
darkmystel

Reputation: 198

Even I had tried everything everywhere :) but what Nate says is true, it works :)

Just make sure you check both login and system certificates , mine had the System certificates set to Always Trust, making me overlook them.

Apple Code signing authority and Apple Worldwide Developer Relations Certificate Authority.

Upvotes: 2

Devaski
Devaski

Reputation: 431

my error was : /Users/XXXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-fictlumohhjzjxcfmyfpwvrjakqa/Build/Products/Debug-iphoneos/XXXX XXX.app: object file format unrecognized, invalid, or unsuitable

Command /usr/bin/codesign failed with exit code 1

Try below. Development system : OSX Lion, Xcode 4.1 iOS 4.3

if you have copied a successfully archived project and modified it for a new version, the copied version may run fine in simulator. But Distribution archive may get the above error. It took a day for me to sort this issue.

  • Right click Your_Project.xcodeproj> Show package contents & edit project.pbxproj file.

Solution : - The Info.plist file may be having more than two copies in the project folders. As well wrong/multiple references in configuration sections inside the pbxproj file. o I have deleted those lines except referring them from Build configuration(Distribution). Set the info.plist reference in project settings as below.

Finally check the distribution settings should be like this..

8917E65D14244E5100B703F8 /* Distribution */ = {
            isa = XCBuildConfiguration;
            buildSettings = {
                ALWAYS_SEARCH_USER_PATHS = NO;
                ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
                CODE_SIGN_ENTITLEMENTS = "";
                CODE_SIGN_IDENTITY = "iPhone Distribution: XXXXXXXX XXXXXXX";
                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: XXXXXXXX XXXXXXX";
                COPY_PHASE_STRIP = YES;
                GCC_PRECOMPILE_PREFIX_HEADER = YES;
                GCC_PREFIX_HEADER = XXXXX_Prefix.pch;
                INFOPLIST_FILE = Info.plist;
                IPHONEOS_DEPLOYMENT_TARGET = 4.3;
                ONLY_ACTIVE_ARCH = NO;
                PRODUCT_NAME = "Product Name";
                PROVISIONING_PROFILE = "XXXXXXXX-XXXX-4ACA-A26E-XXXXXXXXXXXXX";
                "PROVISIONING_PROFILE[sdk=iphoneos*]" = "XXXXXXXX-XXXX-4ACA-A26E-XXXXXXXXXXXXX";
                SDKROOT = iphoneos4.3;
                SEPARATE_STRIP = YES;
                TARGETED_DEVICE_FAMILY = 2;
                VALIDATE_PRODUCT = YES;
                WRAPPER_EXTENSION = app;
            };
            name = Distribution;
        };

Upvotes: 0

Related Questions