Xcode iOS organizer submit to app store yields "The archive is invalid" error - iphone

I just switched from Xcode 3 to 4. When I attempt to upload an app that I have archived to the organizer, I receive this error:
The archive is invalid.
/var/folders/.../app.ipa does not
exist.
This happens after I log in to itunes connect, select the application to update and select next. I am not sure where to begin trying to figure out what is causing this error. Please let me know if I am leaving out anything that would be useful for diagnosing. Thanks

I just faced this problem myself, and I seem to have found a solution to it.
Even though the correct provisioning profile seems to be selected, it might not be.
Try to manually navigate the list of possible provisioning profiles and select the correct one. Do not leave the setting on automatic selection.
In the "Identity:"-list, make sure it does not say "Currently matches...". Manually select the correct one yourself.
That should fix the problem and you should be able to upload to the AppStore.

Okay, so when you install the Xcode 4 package, make sure you have the "Unix Tools" option selected. This was the problem in my case.

If you are running an Xcode beta version (Apple calls it a "developer preview") you will get this error because you're not allowed to submit apps from a beta version. This restriction is not mentioned in the Read Me file or on the Xcode download page. To submit an app, you will need to uninstall Developer Tools, then reinstall the latest non-beta version, then restart your computer.
Here's the command-line command to uninstall:
sudo /Developer/Library/uninstall-devtools --mode=all

Quit Xcode
With a text editor open the file YourProject.xcodeproj/project.pbxproj
Delete all lines containing PROVISIONING_FILE =
Delete all lines containing CODE_SIGN_IDENTITY =
Save & close project.pbxproj
Reopen your project in Xcode
Clean the project
In the Build Settings pane choose the correct code signing identity
Rebuild

I recently switched to a new MacBook Pro and had XCode 4 installed from a Time Machine drive via the Migration Assistant.
Re-installing XCode 4 with the Unix Tools fixed it.
For some reason those files weren't getting copied across with Migration Assistant.

I had the same issue for both TestFlight and App Store. The solution for me was to archive the app, and in the organizer select "Don't sign" when you try to validate/submit or share (in the case of TestFlight).
Hope this helps.

In my case this has nothing to do with Xcode or the unix tools. Indeed I happend to had too many distribution certificates (Why? I don't know). Deleted all of them but one, code sign with this one, re code sign it while validating and submit it with no errors. I hop this help.

A good way to test is to run the build from the command line. Change to your project folder and run 'xcodebuild' and look carefully at the outputs, especially around the 'codesign' command.
I did this and discovered the following:
architecture armv7 object: /Users/chris/Documents/x/x/build/Release-iphoneos/x.app/x malformed object
object file format invalid or unsuitable
So it isn't a solution, but it at least lets you zero in on what the problem is. Anyway, for me, looks like an architecture config error.
Update - to fix this problem, i replaced the copy of codesign_allocate in my /usr/bin folder with the one in /Developer/somewhere and that fixed it.

I tried most of the ideas above, and they did not work for me, likely because I am using he Appcelerator Titanium platform. I did however delete the Build directory and re-built the product and it passed the validation and I was able to upload the binary to the app store.

The same happened to me. My mistake was I had certificates with similar names (like "Provisioning Profile of Giammy", "Profile for Provisioning of Giammy"...).
Running "Archive" from XCode 4.0 and then "Validate..." from the Organizer I faced the "app.ipa does not exist" issue. The problem was that I selected the wrong certificate from those with similar names. The "Archive" phase worked good but the archive did not pass the validation.
Solution: just picked up the correct provisioning profile in the "Archive" phase.
Lesson learned: check twice the provisioning profile name!

Make sure that you are signing with keys for correct product/bundle ID. If I remember correctly, mixing that up could lead in archiving problems.
Also, go to that temp folder and check what IS created. Maybe xCode is creating the IPA under a different name, that could give you a hint.

I solved this same problem by deleting all of the expired signing certificates from my Keychain. Xcode seems to just grab the first one it finds with the given name, regardless of whether it's still valid.

I tried everything including reinstalling xcode4 with unix tools. NOthing works.
I assume I shouldnt have to do this as I'm able to submit other apps without issues.
I'm just having this issue with a partiular project (coming from xcode3).
I even created a project from scratch, imported all the code over and tried again - failed.
so it's not only my project but something in it.
So I've started the process of creating a new project, adding some files, then submitting, then rejecting to figure out what's causing it. This is working so far.
update: ok - it has something to do with using CorePlot and linking it in as a library. and voila - found the answer here.
Can't submit app with CorePlot using Xcode4
Solution: when submitting select "Don't resign"

I was not able to solve this problem by changing or fixing code signing identities (which should resolve this problem in many cases. Nor did simply reinstalling Xcode. These are the top two solutions as I post this answer.
I found success in uninstalling all the developer tools, and reinstalling from scratch.

Here is how I solved it:
Open Keychain and delete all distribution certificates, both from my "login" and from "system".
Download the latest Distribution certificate from the Dev Center.
Double click the certificate to install on Keychain.
On XCode, make sure the certificate name matches on Build Settings.
Build for Archive (a Keychain popup should ask for permission to sign the app).
Archive (again, Keychain confirmation required).
Validate archived app (again, Keychain confirmation will be required).
Submit app (one more time, Keychain confirmation will be required).
If you are building for Archive and you don't see any Keychain confirmation dialog, you can stop at that point because submission is not going to work.

i did have this very same issue using xcode_4.2_and_ios_sdk_5_beta__snow_leopard, my working solution.
Install the previous (non-beta) version of Xcode in a different location and work with that version, and that's it, it worked i was able to upload my app to the AppStore without any inconvenience.
regards,
Jorge.

Never try to submit using apps you built using beta SDKs as your base SDK.
I got rid of this problem by uninstalling all developer tools with the below command
sudo /Developer/Library/uninstall-devtools --mode=all
and then restarted my system and installed that latest non-beta version of XCode and non-beta iOS SDK.

Have you been playing around with the ENTITLEMENTS_REQUIRED attribute at /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/SDKSettings.plist (let say to create jailbroken applications)?
In this case, please reset ENTITLEMENTS_REQUIRED to YES.

for xcode 4 I tried every thing but I can t solve this error until
install xcode 4.2 for snowleopart
if you cant see your app icon in validation page its can be your xcode have error.
download from apple developer page xcode 4.2 and install. its solved.
you dont need to uninstall your xcode 4 just download new xcode 4.2 and install.
I am very fine now

My solution was:
Open the info.plist file in your project and in product name write your products name instead of $[PRODUCT_NAME]

Had this error in Xcode, but had no such error when using the Application Loader. Get to it via Xcode -> Open Developer Tool -> Application Loader. Very frustrating indeed.

Related

dyld: Library not loaded: #rpath/libswift_stdlib_core.dylib

I get this error after adding a Swift class to an old Xcode project.
dyld: Library not loaded: #rpath/libswift_stdlib_core.dylib
How can I make the project run again?
For me none of the previous solutions worked. We discovered that there is a flag ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES (in earlier versions: "Embedded Content Contains Swift Code") in the Build Settings that needs to be set to YES. It was NO by default!
This error can occur if something went wrong during the conversion of an Objective-C project to start using Swift. The issue is that the Linker build settings never got configured properly, so you'll have to do it by hand. Look for the Runpath Search Paths build setting and set it to:
$(inherited) #executable_path/Frameworks
EDIT: I should also add that there has been recent spate of these errors caused by something else entirely - Apple made a change in Swift itself, starting in perhaps Xcode 6.1 or 6.1.1. The only solution seems to be to quit Xcode, destroy your certificates in Keychain Access, go to the Member Center and delete all certificates and profiles (except the profiles for apps in the Store - you can't delete them), and then start the entire certificate request process from scratch.
I'm not really sure why this question is being downvoted, I had this problem as well when I first tried to use Swift with an existing project. An Xcode restart also fixed this for me.
I searched long on this issue. There are several reasons causes this issue.
If you are facing when you and Swift code/library in an Objectice C project you should try Solution 1-2-3
If you are facing this issue with a new a Swift project Solution 4 will fit you best.
Solution 1:
Restart Xcode, then computer and iPhone
Solution 2:
Go to project build settings and set Always Embed Swift Standard Libraries (previously Embedded Content Contains Swift Code) flag to YES
Solution 3:
Go to project build settings and add #executable_path/Frameworks to Runpath Search Paths option
Solution 4:
If none of above works, this should. Apple seems to be ninja patched certificates as mentioned in AirSign's post
At InHouse certificates
Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, O=Company Name, C=FR
they added a new field named OU
Subject: UID=269J2W3P2L, CN=iPhone Distribution: Company Name, OU=269J2W3P2L, O=Company Name, C=FR
so you should just recreate certificate and provision
In my case I was trying to import a custom framework and was getting the similar error.
Turns out I had to import the framework in the Embedded Binaries rather than in to the Linked Frameworks and Libraries.
Embedded Binaries are under Projects Settings -> -> General
For developers who have had this issue with a Adhoc/Enterprise distribution builds,
Create the production certificate from dev portal and then regenerate the distribution profile. Download and install both of them on your Mac. Ensure you selected the right profile in your Xcode build settings and rebuild your app.
Source: https://devforums.apple.com/message/1022908#1022908
Solution 5:
In my case, all solutions mentioned in the answer of accfews were very helpful but none has worked. I solved my problem by adding my swift library in the section "Embedded Binaries" in the "General" section of my Project's target. Perhaps is this due to the fact that I have included my swift framework in my workspace? Whatever it compiles now! Get ready Swift, I'm here!
A simple restart of Xcode solved the issue for me.
For me, the issue was due to the fact that my Apple Worldwide Developer Relations Certification Authority was invalid.
Download it from here:
https://developer.apple.com/certificationauthority/AppleWWDRCA.cer
Drag and drop it into Keychain Access, clean the project, and run.
I had an Obj-C project where I started adding swift source files.
The following fixed the issue for me:
Linking: RUNPATH SEARCH PATHS = $(inherited) #executable_path/Frameworks
Swift Compiler - Code Generation: EMBEDDED CONTENT CONTAINS SWIFT = YES
I just created a new project from the templates Xcode 6.3 and compared the project settings with my old original project.
Try to hold Alt, then go to Product -> Clean Build Folder...
Hope it will help someone..
The reasons for this occurring are many. Having just spent a fun weekend finding yet another issue that causes this (the order of code signing), I wanted to create a summary answer that brings all the possible solutions together:
Add Embedded Content Contains Swift Code to project. You need to set this flag if your app contains Swift code.
Clean project. In addition to a Project > Clean you can also delete the DerivedData and Build directories. Look under the Preferences for the location of DerivedData. Build should be in your project folder.
Ensure Runpath Search Paths contains #executable_path/Frameworks.
Ensure that your certificate contains your Apple Team ID in the OU (Organization Unit) field Apple will add this for you, just revoke your existing distribution certificate and create a new one, download, install on KeyChain, regenerate all provisioning profiles, download those and rebuild.
Xcode restart. If everything is basically good, but Xcode hasn't gotten there yet.
That's the easy stuff. If you are doing your own command line build you may be creating your own .ipa files to upload. In that case you need to ensure the following:
Make sure the version of the Swift files in SwiftSupport/iphoneos is the same as the version in Contents/YourApp.app/Frameworks Because Swift is not yet binary compatible between version, you must ensure these versions are the one that you built your app with. You can find these libraries under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos.
Sign the libraries and frameworks first. You need to codesign the libraries and framework files (under Frameworks in the .app folder) first and then sign the entire .app tree. The .app tree must be signed with an entitlements.plist but not the frameworks.
Hopefully when Swift 3.0 comes out and we no longer need to bundle Swift with our apps this whole issue will go away.
I had this issue using an Ad Hoc (or enterprise) mobileprovision with a production certificate. Switching to a development certificate and mobileprovision solved the issue.
My project is a Swift project with some Objective-C classes.
I had the same problem when signed with old inHouse (enterprise) certificate.
The following steps fixed this for me.
Create and use a new certificate and mobile provision.
(Ref. AIRSIGN’s blog)
Set Runpath Search Paths build setting to: $(inherited) #executable_path/Frameworks.
(Ref. matt’s answer)
Solution 6:
In our case, the Enterprise Distribution Certificate had been revoked. Generating a new certificate and updating the provisioning profile fixed the issue.
(There seems to be many different causes for this error. Hope this helps someone.)
I tried all the answers given above, nothing worked.
Finally worked after updating to Yosemite
I have faced the same issue, setting the right code sign identity solved the problem(Build settings->Code Signing Identity).
As per Apple technical question "All Enterprise and standard iOS developer certificates that are created after iOS 8 was released have the new Team ID field in the proper place to allow Swift language apps to run"
If you add the three frameworks via Embedded Binaries, they will be added to Linked Frameworks and Libraries also. Delete the three entries in Linked Frameworks and Libraries will solve the problem.
Magic methods such as relaunch Xcode and restart the Mac doesn't work on me.
Adding Framework as "Embedded Binary" instead of just "Linked Frameworks and Libraries" - Fixed my issue.
I also set Embedded Content Contains Swift Code flag to YES.
Upgrade to Latest Version of OS X (Yosemite)
After hours of trial & error I came to the resolution of this problem.
- If this applies to your case of course.
I had the same problem until I upgraded my Mac OS X from Mavericks to Yosemite.
- It fixed my problem, hope it fixes yours as well
I tried all the solutions that found on web, including to Apple and new certificates. Without success.
The only way I could run xcode, after 6 months of trying, was creating a new account on my macbook.
Usually this error will disappear if you add this library to the "Copy Files" segment in your Build Phases.
My environment: Cocos2d 2.0, Box2d, Objective C
In addition to doing the other answers above I finally went to the General tab and made WatchKit Optional.
And if all of the above doesn't help you and you really get frustrated... Try the best trick of all: Clean and just to be sure also Clean Build Folder. :) Hope it helps somebody!
None of these solutions seemed to be consistently working for me; after every couple of successful runs, it would fail again. The "Embedded Content Contains Swift Code" flag was always set to YES for me.
Turns out I'd set Xcode to be 6.3-compatible. Changing it back to be 3.2-compatible solved it:
I've had this problem as well, only it wasn't locating libswiftXCTest.dylib.
The solution was to add XCTest.framework to the Tests target, in Build Phases/Link Binary with Library. I was getting this error even when I was trying to build the main target.
This showed up when I added a new Today extension target with Swift language to an old project.
Fixed easily by updating the project to recommended settings. Xcode 6.0.1
I got the same issue using Mavericks, Xcode 6.1.1, testing on an iPhone5 with iOS 8.1.1. I tried all possible solution including new certificates and provisioning profiles, but nothing helped. I did the changes to Embedded Content Contains Swift Code and Runpath Search Paths both on Project level and Target level.
I have now installed Yosemite, and without any further changes, it started to work.
Same issue here, for me it was Crashlytics/Fabric/Beta/Twitter/Whatever-they-call-themselves uploading a binary that was missing the embedded frameworks. If I made an archive and then exported an Enterprise build in the standard way, they worked a charm.
After months and months trying everything here... Definition of insanity... starting Xcode under a new Mac user solved it for me.
I removed ~/Library/Developer/* and reinstalled Xcode- so no clue what else to format to make it work.

Adhoc file installing from iTunes

Not able to install the Adhoc iPA file to my iPhone 4s, it got installed for 3 times to test and then the problem happened automatically. I have checkout my git repository till the last working date, but still the same problem after trying to install.
I get the below image after sync it from iTunes
I can't post the image because of the restriction from the stackoverflow :)
Icon
installing...
Can anybody tell me what is going on?
I have re-checked the Provision profiles and also created a new profile to double check if there was a problem from the certificate but still the same problem. It never get install.
Try to delete the app completely from your phone, then install again. Sometimes the adhoc update has problems with over-installing over an existing app and gives you some strange results.

Another Application failed codesign verification error

I know this has been asked before but tried everything and no luck. Trying to upload my binaries using Application Loader and getting the above error.
Some interesting things for my case:
I accidentally have a space in my App name. Would this cause the code signing to fail?
Looked in the build log and the last entry is * Warning: Defaulting to the standard codesign tool. Could this be the issue causing the problem? If so how do I solve it.
Behind a corporate firewall. I have access to the net but certain ports may be closed. Could this affect it?
Tried everything except revoking all the certificates mainly because I've just created them a few hours ago.
EDIT: OK, I've recreated the entire project, I've revoked all my certificates and recreated them and installed them, I've exported the last version from subversion to make sure subversion is not affecting it, used command line tool to compress it, made the target codesign the correct profile, made the project codesign both default and the distribution profile, tried a different net connection to make sure its not the firewall.
As you can see I've tried everything I can find and the stupid thing still wont work.
Any help?
Cheers
K, This is incredibly annoying. After doing everything as I said in the question and doing some things twice decided to try the Application Loader on someone else's computer. Worked first time, didn't skip a beat.
Strange thing is I have the current Xcode (which I assume is where Application Loader comes from) and the other computer is running an old one. Perhaps the current one is broken?
I had the same issue using XCode4. Turns out I needed to Edit the Scheme and specify that the Build Configuration for Archive was to the be the one for the one associated with the Distribution Provisioning Profile - in my case "App Store".
If you're having the same problem, that may be something to check.
At the project level you want to set your code signing identity, BUT LEAVE THE PROVISIONING PROFILE TO DEFAULT.
Then at the target level you have to set both the code signing identity and the provisioning profile.
If you fail to do that the package will be signed but not interpreted correctly by itunes connect.
I too had this problem, until I realized there's a different way to upload the apps now.
My 'release' Apps build as Archives
If you open the organizer and select 'Archives' at the top, there are 'Validate', 'Share', and 'Submit' buttons in the header info for your app.
Clicking on 'Validate' added my code signing information to the app (after logging in with the appropriate developer login)
Clicking on 'Submit' ran me through the same questions the Application Loader used to ask and uploaded the app without problems. (again after signing in with the appropriate developer information)
Apparently when I updated to xcode 4, it just didn't remove the old application loader.
Rudiger has worked around his problem by updating to the latest version of Xcode, but for others experiencing the error "Application failed codesign verification", see Apple's published list of potential causes at the following URL "How do I resolve the error: Application failed codesign verification?"

Code sign error with Xcode 3.2

I had a fully working build environment before upgrading to iPhone OS 3.1 and Xcode 3.2. Now when I try to do a build, I get the following:
Code Sign error: Provisioning profile 'FooApp test' specifies the Application Identifier 'no.fooapp.iphoneapp' which doesn't match the current setting 'TGECMYZ3VK.no.fooapp.iphoneapp'
The problem is that Xcode somehow manages to think that the "FooApp Test" provisioning profile specifies the Application Identifier "no.fooapp.iphoneapp", but this is not the case.
In the Organizer (and in the iPhone developer portal website) the app identifier is correctly seen as 'TGECMYZ3VK.no.fooapp.iphoneapp'.
Also, when setting the provisioning profile in the build options at the project level, Xcode correctly identifies the app identifier, but when I go to the target, I'm unable to select any valid provisioning profile.
What could be causing this problem?
Update: I've tried to create a new provisioning profile, but still no luck. I also tried simply changing the app identified in Info.plist to just "no.fooapp.iphoneapp". The build succeeds, but now I get an error from the Organizer:
The executable was signed with invalid entitlements. The entitlements specified in your application's Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016).
This seems reasonable, as the provisioning profile still has the "TGECMYZ3VK.no.fooapp.iphoneapp" application identifier.
I also double checked that all certiicates are valid in the Keychain.
So my question is how I can get Xcode to see the correct application identifier?
UPDATE: As noted below, what seems to fix the problem is deleting all provisioning profiles, certificates, etc., making new certificates / profiles and installing them again. If anyone has any other solutions, they would be welcome. :)
I had to manually remove the provisioning profiles from my phone, then rebuild the apps after doing a "clean all targets" from the build menu.
That's under Settings -> General -> Profiles
This happened to me when I got a new Mac. You'll fix it, don't worry
Well, as seems to be the case with a lot of these code signing issues, deleting all provisioning profiles, certificates, etc. and revoking and generating everything all over again turned out to do the trick. I even created a new bundle identifier, app identifier, etc., and now AdHoc distribution is working again.
I had this same error yesterday. I tried all of the various resetting procedures in the other answers with no luck. Eventually I also
rebooted my mac
rebooted my iPhone
deleted all of my iphone provisioning profiles from the phone using XCode
deleted all profiles from my mac (~/Library/MobileDevice/Provisioning Profiles for me)
what else? deleted build folder, restarted XCode, installed update to 3.1.2 sdk, sacrificed a chicken.
Lo and behold, it now works, the error is gone. This is serious voodoo territory.
Also, make sure that you added a reference to the Entitlement filename "dist.plist" in your project configuration CODE_SIGN_ENTITLEMENTS.
Check both Code Signing Entitlements in info for both the Build Target and the Main Application - if Code Signing Entitlements says on either then remove it
In XCode, in the "Groups & Files" pane, expand "Targets" and double-click on your app's target.
This will bring up the Info pane for your target. In the "Build" section, check the "code signing" section for any old profiles. This has happened to me many times particularly after an upgrade to a new version of the sdk and iphone os
Quick Hack if you are on Xcode 4.3.
In Xcode under Project Settings > MyTarget > Summary tab all the way in the bottom there is a checkbox that says "Enable entitlements". When I unchecked it, it made the error go away.
Inside Resources/Entitlements.plist there is a Boolean "get-task-allow" if that is not checked, check it ON. This fixed the issue for me.
After being stumped by this for quite a while I revisited the settings and discovered that I had reversed the 'Code Signing Identity' and the 'Any iPhone OS Device' entries. - The clue I had as to this happening was shown by.
Deleting every profile off the phone
Build and Go
At this point xcode attempts to provision the phone (device)
Examine the phone to see which provisioning profile has been added.
As I prefix all my profiles 'AdHoc' or 'Development' or 'AppStore' I saw immediately that the install process was putting a development profile on the device and not an AdHoc profile.
The device may not be in the list. Try modify your provisioning profile.
Just to add a note here: I encountered the same error (0xE8008016) after replacing my Macbook's logic board (although I imagine you'd have the same problem on a completely new mac), and after hours of going around in circles I realised that the iPhone Developer Program Portal had separate certificates for Development and Distribution.
A change in hardware means you need to reissue both certificates - I'd reissued Developer but not Distribution. Because my name hadn't changed when my hardware did (and certificates are identified by the owner's name), this made it a tricky problem to spot ;) Hope this saves someone else my frustration.
For reference, I ran into the same issue and deleting all of my profiles, existing certs and everything from my local drive and from the developer portal, and deleting my existing devices and re-adding them (developer portal) seemed to do the trick.
The problem is in the "project.pbxproj" file located inside the [your project].xcodeproject file. If you feel brave right click on the .xcodeproject and view contents then open "project.pbxproj" with a plan text editor. Inside search for the offensive path and correct it. In my case I just removed the entire path and just left "Entitlements.plist" and it cleard my issues up. I STRONGLY reccomend backing up your .xcodeproject before attempting this.
Double click the target then select the "Properties" tab. There change the com.yourcompany.${...}.
Another cause is if the device you want to install onto is not an approved device in the Distribution Certificate.
Sometimes Xcode does not automatically copy your provisioning profile to the right location.
In my case, that was true.
Check that your provisioning profile is in ~/Library/MobileDevice/Provisioning Profiles directory and if not just drag and drop, clean and build

/usr/bin/codesign failed with exit code 1

I am attempting to deploy my first development iPhone app, and am running into some problems. I have successfully went though the online Provisioning Assistant, but now I am stuck. No matter what I do, I always get the following error.
/usr/bin/codesign failed with exit code 1
Anyone have any ideas why this is happening?
Update:
The Technical Note in my original answer is now deprecated. Apple posted a collection of code signing problems (and some solutions) in a new document: Technical Note TN2407 Code Signing Troubleshooting Index
Check the CODE_SIGN_IDENTITY property in your build settings. Is your provisioning profile selected there?
You also need to enter a valid bundle identifier in your apps .plist.
The identifier has to match the one you provided when generating the profile.
Apple has a technote about that here.
I just came across this error, and here's what I found out in case this helps anyone: I discovered that you can right click the error message in Xcode and choose expand to get more details, including a description of the problem.
In my case, I had two copies of my developer certificate with the same name in different keychain files, and Xcode couldn't figure out which one to use.
It might be strange answer for codesign issue in Xcode 9.0. I was receiving this error too and did not know what to be done, because everything was correct.
I went to the keychain, I had the login option "unlocked". I locked it and compiled my build again. Xcode itself asked me to open access keychain. I gave access and it worked.
Steps were:
Go to keychain
Lock it
Archive the code, build the project again
I had the exact same error, and tried everything under the sun, including what was elsewhere on this page, with no success. 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".
Others have commented that you may have to do this in System and login keychains for these errors.
There could be a lot of reason when you get this kind of error:
Check whether you have selected a provisioning profile which includes the valid Code Signing Identity and a valid Bundle Identifier in Settings. (Goto Build Settings->Signing->Provisioning Profile).
Open Keychain Access and click on lock icon at top left, so it will lock the login keychain and then again click to unlock.
Goto File->Project Settings->Derived Data and delete your project build folder. After that clean and build your app.
I had the same problem the distribution build. It just happened all of sudden. In fact I did not have this problem a few days ago and I had my Ad-Hoc version compile right. This issue came up because my certificate just expired today. So I went create a new provisional following Apple's guidance: (http://developer.apple.com/ios/manage/distribution/index.action).
After spending hours on the net and made sure I had not fallen for what could go wrong. Here is what save me as suggested by Tobias and Dan Ray:
"...discovered that you can right click the error message in Xcode to view details".
"...the issue was an expired certificate on my System keychain. Keychain Access doesn't, by default, show expired certs".
The detailed information told me about ambiguous matching two certificates. One of them happened to be an expired certificate in the System key chain. So I deleted the expired one then it worked! I also had a concern about what to enter in the "common name" when create the distribution certificate using the keychain utility: my name or my company name. In my case, I entered my name. I am guessing it is the same as the title that addressed by the developer's auto responder email.
Great help. Thanks.
If the error immediately preceding the codesign error says something like 'resource fork, Finder information, or similar detritus not allowed'
Then navigate to the .app file in Terminal and type:
xattr -cr < path_to_app_bundle >
ref: https://developer.apple.com/library/content/qa/qa1940/_index.html
What worked for me was adding --deep to Other Code Signing Flags in Build Settings.
More information here: Codesign of Dropbox API fails in Xcode 4.6.3: "code object is not signed at all"
Unfortunate that this ambiguous error condition has 400 different solutions, but I digress.
I had the same problem. In the end it turned out that my private key did not allow codesign to access it. One can see this in the info dialog in keychain application.
I have to agree with Tobias. The error is too generic. When the same thing happened to me I dug into the error message and realized I'd screwed up something in the build properties, but not the code signing. So yeah, I'd dig in to the details.
In my case error was due to the fact that I had two keys on the keychain with the same name. I deleted the old one and that solved the issue.
Going to the detail message show the real problem to me.
after hours of googling and trying out different things, this is what fixed it for me:
Make sure there are no certificates in the System > Certificates tab on Keychain Access. Remove all duplicate certificates from there.
Install the WWDR intermediate certificate under certificates from the provisioning portal, in addition to the developers certificates and make sure you see it in the Login > Certificates tab on Keychain Access.
hope this helps some of you!
Same issue with ambiguous (matches "iPhone Developer: [me] " and /// tweetdeck's library privatedata file. Fixed it by moving file to the trash and re-logging into Tweetdeck, setting up passwords again. What a pain.
I had the same problem but also listed in the error log was this: CSSMERR_TP_CERT_NOT_VALID_YET
Looking at the certificate in KeyChain showed a similar message. The problem was due to my Mac's system clock being set incorrectly. As soon as I set the correct region/time, the certificate was marked as valid and I could build and run my app on the iPhone
I was also getting this error ("/usr/bin/codesign failed with exit code 1"), and when I looked in Keychain Access my developer certificates were marked as "This certificate was signed by an unknown authority". I had recently upgraded to Mac OS 10.8 and have had a couple of other XCode (4.5.2) issues since then. It turns out I did not have the WWDR intermediate certificate installed. I downloaded that from the iOS Provisioning Portal, installed that in Keychain Access, and my project builds again!
When I got this error I wasn't even trying to sign the app. I was writing a test app and didn't care about signing.
In order to get rid of this message I had to select "Don't Code Sign" from Build Settings under Code Signing.
Sometimes your build folder simply needs cleaning - it certainly worked for me. Thanks to loafer-project for the solution.
One possible cause is that you doesn't have permission to write on the build directory.
Solution: Delete all build directory on your project folder and rebuild your application.
I just came across this error and it was because I was trying to write the build file to a network drive that was not working. Tried again from my desktop and it worked just fine. (You may have to "Clean" the build after you move it. Just choose "Clean all Targets" from the "Build" drop-down menu).
Tobias is correct though, dig into the details on the code by right-clicking it to see what your specific problem is.
One thing that you'll want to watch out for (it's a stupid mistake on my part, but it happens), is that the email address attached to the CSR needs to be the same as the email connected to your Apple Dev account. Once I used a new CSR and rebuilt all the certs and provisioning profiles, all was well in applesville.
Another reason,
Check your Developer account is connected with xCode
Kinda old question, but still happens it seems. Another solution:
Occurred for me after reverting a branch in git.
Tried cleaning, cleaning builds, deleting derived and restarting Xcode, but no luck.
Try rebooting the comp.
I had the same unknown error from codesigning that you mentioned. Similar to the answer provided (but a little different), I just locked my keychain access and unlocked it, and I was able to build and run to my device again. If anyone has the same issue, perhaps try that first before going through the trouble of modifying the keychain password.
Throwing my comments into the ring, I just came across this after attempting to refresh my development environment after clicking DENY accidentally on one of the application requests, after searching around I found a number of things that didn't seem to work. This is the full order in which I've attempted the fixes and whether there was a success:
1) Attempted to clear the DerivedFiles and restart XCode - no dice
2) Attempted to Log and Unlock the Keychain, then restart XCode - no dice
3) Attempted to refresh my developer account within XCode - no dice
4) Bit the bullet and just reset my entire keychain, after doing so my developer account was signed out (signed back in), then restarted XCode - no dice
5) Found an article on here that said that we needed to set the [login|local|System]/certificate/Apple Worldwide Developer Relations Certificate Authority to "System default". But in my case it was already set to system default - no dice
6) Then I looked at my actual developer certificate login/my certificates/Mac Developer: and when I looked in there it was correctly set to Confirm before allowing access BUT there was no entries in the lower section. There should be [Xcode, codesign, productbuild]. I deleted the certificate entry and restarted XCode - bingo
The certificate was added and I was then prompted. So what did I do, I pressed "always allow" and then just boned myself.
I had to go back and delete the certificate again, then go through about 20 allow dialogs during a clean build. Once completed, I was able to build completely.
In My Case, after a fews days of research,
All I did to revolve is listed below:
delete all the certificate on your keychain.
goto your apple account. a) download the specify certificate your want to install on your keychain. b)(Optional) Also create and download the require profile.
in Xcode, clean your project. This may take some time.
Build your project.
This should work for similar codesign issues.
Note, during this process the OS would ask for your credential validation.
I use Xamarin and for me this is what worked after trying everything else.
In Visual Studio for Mac I've opened a .xib file so it opens the project in Xcode.
Went to the project settings > Signing and Capabilities, selected the team and then fixed the Signing Certificate.
I think the issue is with the Keychain Access and certificate trust.
Try adding the following certificate Apple Worldwide Developer Relations Certification Authority from https://www.apple.com/certificateauthority/ (Expiry validity 2030)
The trust warning indicated in certificate will be fixed and then try building the iOS application again
Open the project path in terminal and enter the below commands in terminal
1) find . | xargs -0 xattr -c
2) xattr -rc .
This works for me.