iPhone: Valid signing identity not found annoying error - iphone

I know that this is very common problem and I have gone through almost all the similar threads out here but no luck! This started happening after I renewed my membership with Apple!
I have confirm that I have private and public key in Key Chain, the required certificate listed under My Certificate, have my development certificate, and AWDR certificated installed but still under XCode organizer I get message saying "profile doesn't match any valid certificate/private key pair in default key chain". I also restarted mac twice.
Also I have confirmed everything mentioned at http://developer.apple.com/library/ios/#qa/qa1618/_index.html
What else to do? I have been scratching my head since last 3-4 hours now without any luck!
Thanks.

You could try and have a look at the project.pbxproj located inside the .xcodeproj package (open it by right clicking and select 'Show package contents'). Search the file for PROVISIONING_PROFILE and make sure everything checks out to the correct profiles. I've had problems in the past when Xcode doesn't really update this file but when I do it manually it works.

After so much pain I exported keys from other MAC where it works and imported on my Machine and RESTARTED MAC then it started working!
I could have revoked the certificates and create them from scratch so while generating CA Authority request certificate private keys would be generated on my machine. Learn to save these keys in .p12 format on shared location so that you simply need to double click to install it again!

Related

Application Failed Codesign Warning when Archiving [duplicate]

I am very new to iOS development, I have an app all set and ready to be distributed, but I seem to get this error every single time I run the application on my DEVICE only, the iOS simulator works just fine. Heres the full error:
Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
Here's the entire log:
Validate "/Users/masonsocha/Library/Developer/Xcode/DerivedData/Multibrowser-brgeiknbjgrywwehhohafjwxjqnk/Build/Products/App Store-iphoneos/Multibrowser.app"
cd /Users/masonsocha/Desktop/Apps/MultiBrowser
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv PRODUCT_TYPE com.apple.product-type.application
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation "/Users/masonsocha/Library/Developer/Xcode/DerivedData/Multibrowser-brgeiknbjgrywwehhohafjwxjqnk/Build/Products/App Store-iphoneos/Multibrowser.app"
warning: Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
Executable=/Users/masonsocha/Library/Developer/Xcode/DerivedData/Multibrowser-brgeiknbjgrywwehhohafjwxjqnk/Build/Products/App Store-iphoneos/Multibrowser.app/Multibrowser
codesign_wrapper-0.7.10: using Apple CA for profile evaluation
AssertMacros: trust_result == kSecTrustResultUnspecified, file: codesign_wrapper.c, line: 594
AssertMacros: profile, file: codesign_wrapper.c, line: 918
codesign_wrapper-0.7.10: Failed to load provision profile from: /Users/masonsocha/Library/Developer/Xcode/DerivedData/Multibrowser-brgeiknbjgrywwehhohafjwxjqnk/Build/Products/App Store-iphoneos/Multibrowser.app/embedded.mobileprovision
- (null)
I have already tried shortening the length of the project name, that did not help, I am currently using OSX Lion, on Xcode 4.3.2. I have spent all night pulling my hair out, please help!
May be xcode selects one of the development profile to sign the code with it.
Make sure it uses the distribution profile
press the project, in the Build Settings -> Code Signing section expand Code Signing Identity -> Release - > make sure that Any iOS SDK is referring to distribution profile.
I had the exact same issue..
Go to Keychain Access
Verify that you have your Public and Private keys set up correctly. This is a good reference https://developer.apple.com/legacy/library/technotes/tn2250/_index.html
I had previously adjusted my Keychain Certificate Preferences to make Outlook work but that pretty much screwed up XCode code signing..
After I set these to the "best attempt" setting (see screenshot) validation worked fine
You could solve it is not leaving the profile selection to xcode. Manually select the correct release profile in the project settings and it will go through.
I had same issue even after checking all signing stuff. I had the old "Can be debugged" setting in my entitlements file. Switching it to get-task-allowed fixed the problem. Apple has instructions on how to debug signing issues.
I had this problem but found that none of the above issues solved it. Eventually I found the solution by working through Apple's Technical Note (https://developer.apple.com/legacy/library/technotes/tn2250/_index.html) on the subject.
The specific problem in my case was an asset that was either missing or was hidden (I didn't find out which), but that wasn't flagged as a problem file anywhere else in the build process. I've outlined the steps I took to discover this below.
Archive the build, save for adhoc deployment.
Navigate to the ipa in finder, rename to .zip.
Double-click to unarchive, open the 'Payload' folder
Open a Terminal, and enter the following:
codesign --verify -vvvv -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.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)' /Path/to/your/app.app
Instead of entering /Path/to/your/app.app, drag and drop the *.app file from the Payload folder into the terminal, ensure there's a space between the end of the command and the filename, and hit return.
I got an error in the output saying 'a sealed resource is missing or invalid', with the name of the file causing the problem (it began with a dot, which may have been the problem). When I searched for the filename in the XCode project browser I found the file, but when I looked in the Finder, it wasn't on disk.
The fix was simply to remove the file from the XCode project browser, and the error went away. I would definitely say to anyone getting a similar problem - work through Apple's tech notes. They're a bit badly worded but the solution is likely to be in there somewhere.
I had the same problem and solved it by:
Changing the Automatic Profile Selector value from "iPhone Developer" to "iPhone Distribution" according to section Assigning Provisioning Profiles to Build Configurations.
Download the Distribution Provisioning Profile and double-click on it in order to add it.

Archiving the project give me the following error : The identity 'iPhone Distribution:

I moved the my project from one mac to another new one , i tried to built the project and there is no errors appear , when i tried to Archive it the following error appear
"The identity 'iPhone Distribution: Jeeran for Software Development' doesn't match any valid, non-expired certificate/private key pair in the default keychain"
Please advice me what i can do with error
Assuming archive and building for device was working fine on your old system, the most likely explanation is that you forgot to migrate your private key from your old mac.
Open up Keychain on the old mac:
Choose Category: Keys on the left pane
Find the key, not certificate (type "private key") that you were using to codesign.
Choose File | Export Items. Export the key as a *.p12 file.
Import on your new mac.
If you do it correctly, from Xcode Organizer under Provisioning Profiles you should not see any warnings.
EDIT
This issue is very common: documented at the top of Xcode FAQ
Everything you need to know is in the iOS Code Signing Setup, Process, and Troubleshooting technote
Including what to do if you no longer have access: How do I delete/revoke my certificates and start over fresh?

Xcode's Build and Archive not working

The current issue I'm having is that Build and Archive will build my current target but after it's finished building, a pop-up will appear with the message:
"The operation couldn't be completed. No such file or directory"
I have reinstalled Xcode (3.2.3 with SDK 4.0), rebooted my machine, cleaned the cache, cleaned the project, manually deleted the project build directory. Nothing has worked.
I've also checked ~/Library/MobileDevice/Archived Applications and it is empty.
Any ideas?
p.s. This is driving me crazy!
The error The operation couldn't be completed. No such file or directory also occurs in XCode 4.0 GM preview if you do not change identity to "Don't Re-sign" after selecting (Archives) Share in the Organizer
I had this problem and the solution that was recommended to me was:
Open your Xcode project
Select Unity-iPhone in targets (Double click so it opens the info)
Find "Generate Debug Symbols" and check it on. (Just Search for it in the search field)
This worked for me, but I still don't understand why it was necessary.
All answers failed. Best solution,
drag the .app bundle to iTunes and reveal the app in Finder. Boom! you get your ipa there.
Since it only seems to happen with your release configuration, double check the "Build Locations" values in your project settings for the release configuration.
Check the paths in the "build locations" to make sure they exist
Check the permissions for those paths
Try doing just a build (no archiving) for your release configuration
Also keep an eye on your build results window during the build to see if there were any warnings during the signing and packaging stages that could give you clues
Had the same issue and none of the mentions solutions worked.
I finally found the problem when I tried to directly sign the app with the adhoc profile: it told me that I had twice a distribution profile in my keychain. I deleted the old one, then compiled again with the dev profile, and then archiving with the adhoc profile and it worked.
Longshot answer - do you have any unusual characters in your project path? This release note indicates it can cause problems:
While most known cases have been taken
care of, having a space, comma, slash,
backslash, tilde, or other character
special to the Unix shell in the
directory name of any parent folder of
your project can cause your project
build to fail in unexpected ways.
If you have a 3:rd party SDK you need to add "$(SDKROOT)/ResourceRules.plist" to the “Code Signing Resource Rules Path” key in the targets build settings.
I solved this problem by exchanging the wildcard adhoc distribution profile I was using for an app specific adhoc distribution profile.
Of the top of my head, I would check permissions. Some code reports permissions problems as there being no file/folder. Check the Console log. You will sometimes find more info there.
Did you install into /Developer? If you've customized that folder the issue could be that the path contains a space, which could be causing your problem.
Run the Console app and see what information is being spit out there. That should give us more insight into the issue.

How to fix "failed codesign verification" of an iPhone project?

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!
For me the following steps resolved the issue:
Go to Product > Edit Scheme.
Open the Archive Profile.
Set Build configuration to Distribution.
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:
Open KeyChain Access application
Select the 'login' keychain, and select in the bottom pane 'Certificates'
Switch to the 'system' keychain and see if there are certificates registered in both chains.
Remove one of them
Rebuild the application
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.
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.
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.
In menu, select View > Navigators > Show Log Navigator. The Log Navigator should be displayed on the left side.
In the list of builds, select the one that causes troubles. The log from the build will be shown in the main view.
Scroll to the very bottom. The last two steps should be CodeSign and Validate, where the Validate step contains the warning.
Expand CodeSign and inspect the parameters used to perform the code signing.
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:
In the menu, select Product > Edit Scheme
In the Edit Scheme dialog, select the Archive build item (list on the left)
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.
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.
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.
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!!!
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?
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;
I fixed this simply by deleting my distribution certificate from keychain then downloading it again from the provisional profile
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,
Simple Solution: Build your app using a DISTRIBUTION certificate and not a Developer cert.

Receive message "A signed resource has been added, modified, or deleted" when trying to debug an App on iPhone

While attempting to debug a build created using the 3.2 SDK on an iPhone device I receive the message "A signed resource has been added, modified, or deleted.".
I can clean, rebuild, then install with no error, but if I try to install without cleaning the error shows.
Anyone have an idea as to what might be causing this?
I found a workaround for the bug.
If you delete the .app file in build/Debug-iphoneos/ before building for the device, the app gets installed without errors.
And there is a simple way to do that before every build.
Make sure you have selected "Device" in the dropdown overview menu.
In XCode go to Project > New target...
Then find "Shell Script target" under MacOSX/Other
Name it and add it to the current project
Now, in the left navigation panel, under targets, expand your newly created target and double-click on Run Script.
In the window that opens replace "# shell script goes here" with "rm -fr build/Debug-iphoneos/*.app" (without the quotes).
Now open your main target preferences and under Direct Dependencies add your newly created target.
Build and Go! :)
This error occurs when there is a special character in the Product Name. In my case it was a "?"
If you change the Product Name it automatically updates the "Bundle Name" and "Bundle Display Name" so it is often the best choice to rename an app.
If you want to include special characters in the app name you have to manually rename the "Bundle Name" and "Bundle Display Name"
Bundle Name: This is the actual app bundle name in the file system such as "Awesome App.app". It is generally not visible to the user.
Bundle Display Name: This is a short name displayed under the app icon on the device. Since the bundle name would be truncated to "Awes…tion" you have the option to have a shorter name which fits better such as "Awesome App". It should be similar to the App Store name (set in iTunes Connect)
This is pretty clearly a bug in the 3.2 SDK, but I don't want to downgrade. I've found that doing a Clean by pushing Command+Shift+K, then Return is pretty fast before pushing Command+R to build.
Xcode 8, reason of the "A signed resource has been added, modified, or deleted." was that target was signed with an enterprise provision profile.
In my case, it happened when no changes were made. Make a change to any file and run again.
This can have several causes. The fastest way to figure out what is causing it is to go into Xcode, Window menu, Devices, then click the reveal button at the bottom of the pane to show the Console. Now attempt to run. You should see log output that names the specific files it is complaining about.
Most of the solutions previously posted are just artificial ways of getting Xcode to regenerate the contents of the build folder and/or re-sign the files.
In my case, my WatchKit extension was somehow acquiring references to Cocoapods frameworks that were only targeted toward the main app so they got signed during the build, then pruned later (as they were not used). Then on device, iOS complained that they were missing from the .appex folder for the extension. I ended up not needing any pods in the extension so I just removed them all and removed the extension as a target, then did some minor cleanup to remove the pod-related debris left in the build steps. Now everything works perfectly.
(SOLVED) This is a weird one. I tried everything I could find. Eventually I changed the product name from "Unit Tests (device)" to "Device Unit Tests" - removing the brackets. Now everything works. The spaces in it appear to be fine.
Previously on stackoverflow:
I've just run into this bug with two static library projects. One builds and tests using the GHUnit test runner on the device without a problem. The other projects will not install and gets this error. That means it's something thats different between these two projects. I've so far tried wiping the build directory, taking spaces out of the executable name, and various clean and builds as suggested here.
Same for me, thought it has something to do with multiple targets etc. because I changed a lot there. But it's highly possible that it's a Bug in the 3.2.2 release since I did not test extensively in this sdk version before the massive target changes in my project.
solved my issue!!!
I found out by accident that somehow a space " " found it's way into the Product Name of my app so it was called "First Second.app" instead of "FirstSecond.app". After deleting the space the issue was gone!
I changed it here:
right click on target
Get Info
Build Tab
Packaging Section
Product Name <- The name here will be used for the bundle (.app) name
Hope this helps, let me know!
Cheers,
nils
I could solved by changing project name.
[project]-[Rename] menu. "phase1 (new)" -> "pahse1"
I was getting this same error, but intermittently. I tried all the above and it still didn't work. Today I found what was causing it.
The error seems to occur when editing a xib in interface builder. If you try to run while the interface builder is open in xcode it will cause the above error. To solve just close the interface builder editor. i.e. just select a code file from your project so you are in the Source Editor.
The simplest (and probably most common cause) appears to be rebuilding without any changes.
So the simplest thing to cure it is to make a trivial change to a source file (such as adding a space, then deleting it), and then rebuilding.
If this doesn't work, feel free to try all the other answers here.
For months, I'd get this error without realizing it was due to such a simple cause. I'd usually do a Clean Build to get rid of it.
When I created ipa through terminal using xcodebuild commands, ipa created but while installing it I was getting same error. exportOptionsPlist solved my issue.
xcodebuild -exportArchive -archivePath projectPath/myapp.xcarchive -exportPath projectPath/myApp.ipa -exportOptionsPlist ProjectFolder/exportPlist.plist
In my case, Quit and restarting XCode worked.
For me the issue was related to the provisioning profile settings. The clue to this was that debug builds were installing ok, but release builds were not. I wanted to test a release build, so I ran the scheme with that build configuration.
I fixed it by duplicating the Release Configuration, then modifying those fields in the Build Settings to have the same provisioning stuff as if I am debugging it.
(Adding another build configuration will give you headaches if you are using Cocoapods however, then you'll have to modify your Podfile)
I'm getting the same thing, when installing on a iPod Touch. I can't link for the simulator (for other reasons), so can't say whether the problem occurs there.
Yes, rebuilding clean or deleting the app from the device allows me to install again. Neither are desirable, iterative solutions!
The minimal "cleaning" I've come across as a work around is manually deleting the Foo.app in the build/Debug-iphoneos directory.
it seems this is a bug in xcode 3.2.2:
iphonedevsdk
I had the same problem in Xcode 3.2.1 when I put a + in my app name. Specifically the "product name" in the build settings. It is fine to have a + in the bundle name in your Info.plist. The same probably applies to other punctuation characters.
Go to Window > Organizer > Projects > Find your project and delete derived data
I got this error intermittently while installing app using iPhone config utility on Windows7. Following solution works - Go to C:\Users\{lanusername}\AppData\Local\Temp and delete app specific folders (e.g. abc.app) and try installing app again.
I reported this bug on ICU (Windows versions) to Apple in June 2011. With the following workarounds:
The workaround is this ....
Win XP
1) Close ICU
2) Delete the temp folder: c:\Documents and Settings\[username]\Local Settings\Temp\[AppName].app
3) Delete the deploy folder: c:\Documents and Settings\[username]\Application Data\AppleComputer\MobileDevice
4) Restart ICU. Drag in the App and install normally.
============================
Win 7
1) Close ICU
2) Delete the temp folder: c:\Users\[username]\AppData\Local\Temp\[AppName].app
3) Delete the deploy folder: c:\Users\[username]\AppData\Local\Apple Computer\MobileDevice\Applications\[AppName].app
4) Restart ICU. Drag in the App and install normally.
=========================================================
I simply rebuilt my app, and that solved the issue.
I also faced the same issue. After wasting lot of time I realized that my product name has a special character "?" which cased the problem
Having the DerivedData folder at a network location caused this problem for me.
After trying everything else, I found out my workstation couldn't agree with the University server about what the time was. (It thought everything was always modified). I also had to clean for every rebuild to avoid that frustrating message.
In the end I gave up and built locally, changing Xcode > Preferences > Locations ... feeling altogether pretty dumb for having ever built over the network.
We ran into this issues on XCode_6.3.1. We were building a AppleWatch app, with an extension. We do have a bunch of Pods.. After debugging the issue for almost a bunch of hours, what we found was that there was an issue with the way a file was adde to the project..
It seems like some references to a unused file was sitting in the iPhone App, though it was used in the Watch App.. It turns out that the error XCode was showing was totally useless.
After removing this file and re adding it back to the project the project started working fine & was able to install to the device. To make it even harder to debug the issues, the debug version was installed without an issue, but was unable to install the norman version..
Make sure you add your files to the right target and, look at git history and see if there are lingering fragments that are added to the wrong target.
This is a very general error message indicating something is wrong during the validation process of the code signature. To find out the specific error, you can go to Xcode->Window->Devices and check your device log.
In my case, I have following console spew
Feb 1 18:53:07 iPod-touch installd[40] : 0x1001f8000 -[MICodeSigningVerifier performValidationWithError:]: 192: Failed to verify code signature of : 0xe8008017 (Signed resources have been added, removed, or modified)
Check on this 3rd party framework again, I found an extra CodeResources file under the framework root. Remove that file fixed the problem.