Xcode 11.6 Command PhaseScriptExecution failed with a nonzero exit code - ios

I'm trying to Archive my build in Xcode 11.6 running on macOS 10.15.5 and every time I get the same error "Command PhaseScriptExecution failed with a nonzero exit code".
In Signing & Capabilities option I've chosen Distribution provisioning profile on both tabs Debug and Release and I've disabled automatic signing.
I have 2 certificates: one for development and one for distribution.
Here is the error:
I've already tried Keychain lock and unlock. On Xcode 10 and macOS 10.14 this worked without any problems.
Can you help me please,
Robert

According to the error message, it seems there is a build script that tries to run another script called copy-www-build-step.sh, and gets a "Permission Denied" error. The most likely cause is simply that the script file does not have execute permissions (no files have this permission by default, and permissions are often lost when e.g. unzipping an archive).
This can be easily solved by running the following command in Terminal to enable execute permissions:
chmod +x /path/to/copy-www-build-step.sh

Related

Not able to deploy flutter application to iOS Appstore

While Building the app for iOS Distribution in flutter I faced the below issue with the build, I tried many things available on google related to this issue but no resolution yet.
How am I supposed to deploy flutter application to iOS Appstore?
Warning: unable to build chain to self-signed root for signer "iPhone Distribution: Mark Davids (*********)"
/Users/mark/Downloads/chat_app-master 2/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App: errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
This is a vague error, however my guess is its 1 of two things.
There is Flutter detritus that is blocking your build, which you can fix by running the flutter clean command
Your certificate is invalid. When dealing with this in the past I have found the easiest way to fix it is to open XCode, set the signing to none, purge your certificates and keys from your system, and then re-add them to the keychain.

Command PhaseScriptExecution failed with a nonzero exit code Xcode 11.4

I am trying to build an archive for my flutter app on Xcode, bt I do not know why I kept getting this error.
Command PhaseScriptExecution failed with a nonzero exit code
I have my project migrated using the manual migration guildlines for the Xcode 11.4 version. My project runs well on the simulator though but I cannot build the .ipa archive file.
Logs
/Users/apple/Library/Developer/Xcode/DerivedData/Runner-acigcqmznpynacbcdnfflfigyoxx/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Kashbase .app/Frameworks/Flutter.framework/Flutter: errSecInternalComponent
Non-fat binary /Users/apple/Library/Developer/Xcode/DerivedData/Runner-acigcqmznpynacbcdnfflfigyoxx/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications//Kashbase .app/Frameworks/App.framework/App is not armv7. Running lipo -info:
Non-fat file: /Users/apple/Library/Developer/Xcode/DerivedData/Runner-acigcqmznpynacbcdnfflfigyoxx/Build/Intermediates.noindex/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications//Kashbase .app/Frameworks/App.framework/App is architecture: x86_64
Command /bin/sh failed with exit code 1
Try this workaround:
Go to
Keychain Access -> Right-click on login -> Lock & unlock again
Xcode -> Clean Xcode project -> Make build again
Keychain Access
is a program in your Mac in Utilities. Cmd Tab keychain Access to find
it.
You can also try other solutions here if the workaround mentioned above is not working.

Codesign error, flutter clean required every time

Ok so I've have this issue which is
resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Could not build the application for the simulator.
When building my flutter app. After much investigation, and following what is written here Codesign error with Flutter on iOS
Running flutter clean removes the error, however, when closing the simulator and re-running debug again the error is displayed... is there a more permanent fix for this?
I've also followed the commands outlined in this thread too Code Sign Error in macOS High Sierra Xcode - resource fork, Finder information, or similar detritus not allowed
In this case use xattr -cr. command in the Project Directory Terminal.

Codesign returns unknown error after "replacing existing signature"

I am trying to build a Xamarin iOS app using xbuild on Jenkins. Sometimes the build fails during the codesigning process with an unknown error -1=ffffffffffffffff and sometimes the build succeeds. The provisioning profile is stored in a separate keychain jenkins.keychain (not the system or login keychain) that is referenced by Jenkins through the Keychains and Provisioning Profiles Plugin.
This is the console log of Jenkins:
Target _CodesignAppBundle:
Codesign Task
CodesignAllocate: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
DisableTimestamp: False
Entitlements: obj/iPhone/In-House/Entitlements.xcent
Keychain: <null>
Resources:
bin/iPhone/In-House/MyApp.app
ResourceRules: <null>
SigningKey: 123
ExtraArgs: <null>
IsAppExtension: False
Tool /usr/bin/codesign execution started with arguments: -v --force --sign 123 --entitlements /private/var/lib/jenkins/workspace/Master/Apps/iOS/obj/iPhone/In-House/Entitlements.xcent /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app
bin/iPhone/In-House/MyApp.app: error : /private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: replacing existing signature
/private/var/lib/jenkins/workspace/Master/Apps/iOS/bin/iPhone/In-House/MyApp.app: unknown error -1=ffffffffffffffff
Task "Codesign" execution -- FAILED
Done building target "_CodesignAppBundle" in project "/private/var/lib/jenkins/workspace/Master/Apps/iOS/MyApp.csproj".-- FAILED
As suggested in Codesign returned unknown error -1=ffffffffffffffff I added set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ${KEYCHAIN_PW} ${KEYCHAIN_PATH} to my build script but it did not fix the issue.
Do you have any idea how to address this issue? Why is there an existing signature to be replaced?
Update 1 - We keep getting the error after:
switching from xbuild to msbuild version 15.3.0.0
setting jenkins keychain to "Allow all applications to access this item"
deleting the derived data folder
not using relative paths for security commands
A similar problem is described in the Apple forum.
What fixed the issue:
The keychain filename extension changed from *.keychain to *.keychain-db on macOS Sierra. The code signing error was caused by referencing the old keychain file while we were editing in fact the jenkins.keychain-db file containing updated certificates. Keychains with the new extension are rejected from the upload with Jenkins' keychain plugin. So we do not use the keychain plugin any longer and store the signing certificates inside the login.keychain-db. With this we can successfully build the app without the unknown error.
My resolution to this problem was ensuring that the Mac had proper permissions to use the new certificate. I was getting this code signing issue when trying to run a Jenkins job, but things ran properly on my local machine. When I tried manually code signing one of the Swift libraries (e.g. libswiftos.dylib), the Mac then asked for a password to be able to use the new certificate. Once I did that, the Jenkins job ran successfully.
Restarting the Mac could Fix the issue

Ionic run fail to deploy to device

I am using Mac OS X 10.11. I am trying to deploy build to device (iPhone 4) by running sudo ionic run ios --device and I get this error message:
Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) were found.
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/john/Desktop/Myproject/platforms/ios/cordova/build-debug.xcconfig,-project,Myproject.xcodeproj,ARCHS=armv7 armv7s arm64,-target,Myproject,-configuration,Debug,-sdk,iphoneos,build,VALID_ARCHS=armv7 armv7s arm64,CONFIGURATION_BUILD_DIR=/Users/john/Desktop/Myproject/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/john/Desktop/Myproject/platforms/ios/build/sharedpch
ERROR running one or more of the platforms: Error: /Users/john/Desktop/Myproject/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
I have no problem when running just only ionic run ios, which will deploy the app into emulator. How can I overcome the problem?
Another method will be
Go to your platform directory of your project /platforms/ios
Write in the console open . which will open your folder with Finder.
After that open YourProject.xcodeproj with XCode and select your device and click on run.
Good luck

Resources