Since updating to Xcode 13 I get a codsign error - ios

After updating to Xcode 13.x on Monterey, I've started getting numerous Code sign error(s): Command usr/bin/codesign failed with a nonzero exit code when building my project.
Cleaning Build Folder and deleting derived data are NOT working as a fix. Any suggestions?

I found a solution to delete the Apple Worldwide Certificate in my Keychain Access. It seems to recreate when building and fixes the codesign error. Sometimes there are 2 certificates and I just delete the older one:

For me, xcode13.4 / monterey osx, iOS 15.0 device. I recently upgraded to monterey and for some reason was the certificate not trusted in the keychain. I had to manually trust the keychain and then it worked. See this also. https://support.apple.com/guide/keychain-access/change-the-trust-settings-of-a-certificate-kyca11871/mac

Related

flutter swift Command PhaseScriptExecution failed with a nonzero exit code

When i want to make archive to upload app on apple Store in the end of archive i get this error /bin/sh -c /Users/aneeq/Library/Developer/Xcode/DerivedData/Runner-hfzveethzxphozduylnhsnbtzzct/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
and also this waring
None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (x86_64).
can someone kindly help me with this and also its run fine on emulator.
Its flutter Application not Native.
The problem is that you need the latest version of MacOS and Xcode, in this case, Xcode 12.5.1 and MacOs Big Sur 11.5.2.
Generally, that can be a problem that you do not have the most recent version of MacOS and Xcode, you can try updating or checking if you have any update, then check if you have your linked libraries correctly.
Had this issue, Fixed by opening XCode using rosetta.
I see many people experiencing this problem - and many different possible solutions. For me, I had accidentally messed with the certificates in Keychain Access. To fix, I deleted those, signed out of my account in Xcode (preferences), and then signed back in. Then in signing and capabilities, I'd select my account, Xcode would prompt me to revoke the old certificates (no longer found) and then create a brand new set. Then my app would build.
For me, clean derived data was required.
~/Library/Developer/Xcode/DerivedData
just delete import 'dart:html';

Xcode 9 - Alamofire Pods. Command /bin/sh failed with exit code 1

/Users/Alex/Library/Developer/Xcode/DerivedData/MyProject-ehabmnclpzlywhabrefntacibonm/Build/Intermediates.noindex/ArchiveIntermediates/Fuego/InstallationBuildProductsLocation/Applications//MyProject.app/Frameworks/Alamofire.framework: unknown error -1=ffffffffffffffff
Command /bin/sh failed with exit code 1
I got this issue when I Archive my project. When I run app on simulator it works ok without such issue above.
Also it works ok with Xcode 8, but now when I try to Archive it on Xcode 9 I have this issue. But maybe this is not the case as I reinstall Mac OS from scratch, so it maybe cocopods version issue I am not sure.
Also two // here in the example above is also strange for me /Applications//MyProject.app
I believe it's a Xcode's bug. Restart your Mac and try to build again. Xcode would ask permission to access your Keychain before build Alamofire, then just allow it.
Hm it's very strange after some search on the Web I found that this is actually signing issue.
I used Xcode to generate new distribution certificate and maybe this leads some problems for me.
What I did to solve my issue.
I removed all certificates on my Mac and in my apple account.
I removed all prov profiles as well on my Mac and in my apple account.
I requested certificate and save it on the disc manually (not via Xcode )
I recreated certificate and profile. Downloaded it manually and double click on it.
After that I faced with keychain issue when I can not enter password to allow signing my certificate. I use this link to move certificate form login to system section.
Finally I get it work.

Upgraded to XCode 9.1, Command /bin/sh failed with exit code 1 error

I have an existing app, and upgraded the OS on my mac High Sierra and also Xcode from 8 to 9.1. Since then, when I try to build, I am getting an error with some shell script failing. The strangest thing is that this happens only when I try to build using my iPad device. No problems iPhone device or simulator, and no problem with iPad simulators. I tried updating all the pod files, clearing Derived Data and similar things. Below is the screenshot with all the error info. I am a newbie to iOS programming, and any help is very much appreciated. Thank you all in advance.
This is a typical signing issue. Try delete Keychain certificates pertaining your project and rebuild using fresh ones off developer.apple.com.

dyld: Library not loaded: #rpath/libswiftCore.dylib on Xcode 9 only

I recently upgraded to Xcode 9 from 8.3.3.
Our project is written in Objective-C as are all the other frameworks we use. I have added a framework which is written in Swift (version 3.0). In Xcode 8, I am able to build and run the project without problem in simulator and on device. In Xcode 9 I am unable to run the project on simulator or device due to the error:
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: .../libraryname
Reason: image not found
After downgrading, I was able to run the project again.
My configuration has:
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
STRIP_SWIFT_SYMBOLS = NO;
SWIFT_VERSION = 3.0;
After battling for several hours with this error and trying various solutions, my solution turned out to be different than others here so I'm adding it for others who may benefit.
I tried:
- ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
- LD_RUNPATH_SEARCH_PATHS = $(inherited) #executable_path/Frameworks
No luck. Turned out the issue was more basic. My project has multiple build targets and somehow the setting for Host Application had gotten unset.
The Swift framework has to be built with the same version of Swift as your project (in this case Swift 4 inherantly since you upgraded and are running through Xcode 9).
Rebuild and re-add/replace the framework with the new version and it should work.
Are you using Carthage and have multiple XCode_s on your machine? I had an issue recently when I ran
carthage update --use-ssh --platform iOS while xcode8.3.3 was selected in the command line. Then included built frameworks into the build.
For it to work in XCode9 you will need to run switch command
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer for your Xcode.app and run carthage again.
Hope it helps.
Had the same problem. I'm using Xcode 9.2, Swift 4 and my device runs in iOS 11.1.
Solution:
I deleted Apple Worldwide Developer Relations Certificate Authority in Keychain Access and replace it with a new one (you can download certificate here)
After that, I have changed "Trust"(double-click the certificate) from "Always Trust" to "System Default".
Try restarting Xcode. I tried everything else and this is what stopped the problem.
It mainly occurs if your certificate trust settings is set to "Always Trust". Change it to "System Defaults" and recreate the build. This should solve the issue: https://egeek.me/2017/10/21/code-signing-blocked-mmap-on-ios-device/
I faced the same problem (on Xcode 9.4.1) but couldn't solve it with any of the help. I faced a problem where Xcode kept on prompting me to use my keychain but couldn't complete the request—although I gave my password. The app built successfully and installed. However, it crashed upon running on the device immediately.
Here's what solved my issue.
Deleted my Certificate & public/private key pair
Created a new Certificate (via a CSR) and installed it on my computer
Linked the new certificate to the provisioning profile and installed the profile on Xcode
Cleaned the build and deleted the existing build on the device
Hurray!!!
Hope this helps someone who is searching through the planet!
Just clean and built solve this problem. Tested in Xcode 9.2 and Swift 4

Xamarin cannot build to device - Tool exited with code: 1. Output: error: The specified item could not be found in the keychain

I am trying to build an iOS app in Debug|iPhone configuration on Xamarin Mac, but I am getting:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: Tool exited with code: 1. Output: error: The specified item could not be found in the keychain.
This all started when I had to reset my default keychain and lost my certificates. I've tried fixing it by:
Creating a new certificate manually (ensuring I had "Apple Worldwide Developer Relations Certification Authority" when requesting the certificate from the certificate authority as suggested here)
Creating a certificate using xcode 8.3.1 (exporting this certificate onto another machine lets me build fine on that machine)
Importing my certificates from my old keychain (each time I created a new certificate I ensured to update and download the provisioning profile)
exporting a working certificate from another user on another machine and importing it onto my machine
uninstalling Xamarin studio, deleting the folders mentioned here, and installing Xamarin Studio 6.1.3 + Xamarin.iOS 10.4.0.123 (was using 6.1.3 + 10.2.1.5 previously)
uninstalling Xcode 8.1 and installing Xcode 8.3.1
installing visual studio for mac (this gave me a different error "EnsureBindingRedirects task failed unexpectedly" - likely a separate bug)
The fact it failed to build when using a known working certificate/provisioning profile combo on another machine leads me to think that Xamarin is having a problem finding the certificate when doing the build, even though it sees the certificate and provisioning profile in Project Options -> iOS Bundle Signing. There could also be an issue in the Keychain somewhere.
Any help on this would be greatly appreciated.
I fixed this by doing the following:
security dump-keychain -d login.keychain to list all the items in my keychain
Noticed there was an extra certificate that was not showing up in Keychain Access
Deleted this item using security delete-identity
Did diskutil resetUserPermissions / $(id -u) and restarted my Mac
I'm not sure if steps 1-3 are necessary, so if you are having this issue I would try step 4 first and see if that works.
I am using Visual Studio on a mac and my solution was to shut down Visual Studio and start it again after logging out of Apple Developer Account in the visual studio preferences.

Resources