Xcode's Bot always returns error - ios

I got an issue with Xcode's Bot. It always returns the "User canceled the operation. Command /usr/bin/codesign failed with exit code 1" error string after running the command below:
/usr/bin/codesign --force --sign <MY_PRIVATE_KEY> --entitlements /Library/Developer/XcodeServer/Integrations/Caches/2cdd321641e8c114e4eba9819b017479/DerivedData/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/MyApp.app.xcent /Library/Developer/XcodeServer/Integrations/Caches/2cdd321641e8c114e4eba9819b017479/DerivedData/Build/Products/Debug-iphoneos/MyApp.app
I can run this command in Terminal with sudo. I'm using Xcode 6.3.1 and OS X Server 4.1.53 in my Mac 10.10.4.
Thank for your help.

This looks like a code signing error. There are a few different reasons for this to happen so you will need to do some troubleshooting. Can other bots build on your server? If so then its probably a build settings issue in this specific project.
In the Xcode Project go to the Project Target that your trying to build, and then Build Settings, and Code Signing. Under the Provisioning Profile you can either choose Automatic or explicitly choose the correct provision, and then under the Code Signing Identity choose iOS Developer. This is probably where your issue is if its related to the project. Do you have a proper provision setup for the project on the Apple Developer Portal?
If you can't get any bots to run on your server then the issue could be with how you set up Xcode Server. Have you added the server to your team? Here is the blog post that I used to get mine up and running, although you don't need to do all of those steps in the post. Focus specifically on the Setup Certificates section and Setup Provisioning Profiles section.

I fixed the issue by copying the missing provisioning file from my local directory "/Users/phuongle/Library/MobileDevice/Provisioning Profiles" to "/Library/Developer/XcodeServer/ProvisioningProfiles". Do not use the downloaded provisioning file from developer.apple.com directly.
I just want to note here for everyone having the same issue with me.

Related

I think I have done necessary code signing work but build still failing in Ionic

Building an Ionic app to try and test on my iPhone. I downloaded XCode last night and went in and created a profile with my Apple ID, as well as changing the bundle identified in the "General" and "Signing & Capabilities" tab. However when I run "ionic cordova build ios --prod" I get the error:
error: No profiles for 'io.ionic.starter' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'io.ionic.starter'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'MyApp' from project 'MyApp')
** ARCHIVE FAILED **
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
cordova build ios exited with exit code 65.
Re-running this command with the --verbose flag may provide more information.
It seems to me as though I have done the necessary code signing procedures that I read from Ionic's website, so I am unsure why it still isn't working.
To run the app in your iPhone there are several steps, check these:
You have created your app ID in the website.
You have created your provisioning profile in the website, and downloaded to your computer and added to your Mac (web -> download profile -> double-click)
You have created a development certificate (search how to create a certificate using a Certificate Signing Request generated in your Mac ) and then downloaded that certificate and added to your Mac.
There are two certificates. Distribution certificate is used to publish the app, but development certificate is used simply to run the project in your iPhone, you need that.
But honestly, it's all much easier if you use XCode instead of the console. In the console run the command without --prod, to apply ionic changes to the iOS project. Then if you want to run the app, it's easier if you open XCode and just click play.
With XCode there's the option "Automatically manage signing" that will handle most of this for you automatically. You just have to login to your account using XCode (it will prompt you) and let it do it for you.

How to resolve error of "errSecInternalComponent" while building archive for appstore?

I am trying to submit flutter app to Appstore. Here are the steps I followed:
Deleted all certificates and provisioning profiles
Create/Add IOS Distribution Certificate
Create IOS Provisioning Profile
Add IOS Provisioning Profile
Clean App
Build Then Run App
Set Codesigning and Provisioning Profile In Build Settings
Lots of Googling > to no successes
Basically, facing the error of "errSecInternalComponent"
Here is the error I get:
Warning: unable to build chain to self-signed root for signer "iPhone Distribution: Johnny (**********)"
/Users/johnny/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
You are having an issue with a certificate, that's why you get this warning. You need to generate a new one.
Try this:
xcode -> preferences -> accounts -> select the account -> manage certificate -> click on the (+) icon in the bottom left side of the popup window -> ios development
Build the first time with Xcode, Xcode will ask you to update the keychain, click on always allow.
After that, your command line build will work.
For me the following worked - even from a ssh session:
security unlock-keychain -p "<my password>"
Since the issue is already resolved, this might not be the answer to you.
However, I would like to share this with the community as I stumbled upon the same error message with another setup.
I have been building an iOS App with Xcode on a MacMini used as gitlab runner.
Building the app manually worked, but whenever I pushed to the repository and the automated build started, this error appeared.
Updating the ruby version to a higher version than BigSur's shipped one and reinstalling the gitlab-runner resolved my issue.

Error Signing Xamarin.iOs Application { codesign exited with code 3. }

I'm trying to Build a xamarin.ios app with VS2019 installed in windows, connected to macOs added as a remote build server. Everything is ok, but when is trying to verify the signature fails showing this:
error : codesign exited with code 3
After some debugging we found out that the VS is loging of the dev's portal for some reason.
I'll appreciate your help.
Thanks!
CodeSign encounters issues to verify the signature of your signing certificate, provisioning profile and App. I first ran into this issue when building on MS AppCenter, but was able to reproduce after running the Archive for Publishing command from Visual Studio
Use Terminal to execute codesign with detailed logging on your App by using the following statement:
codesign -dv MyApp.app
Note: You can drag and drop your MyApp.app from your Finder window into the Terminal app.
Details about your signature will be displayed. In my case "TeamIdentifier=not set" and the "Signature=adhoc" were shown, while I was developing an InHouse app, meaning that the provided Provisioning Profile was generated as Ad Hoc instead of InHouse.

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.

"No code signing identities found" error building cordova app for iOS device

I am trying to build a cordova app for iOS here on my Mac, and I am plagued by the "No codesigning identities found" error. Based on other posts, the frequent resolutions include stopping and restarting Xcode and rebooting, and redownloading the provisioning profile. None of that has worked for me.
It is odd because I reference the provisioning profile by GUID in my build.json, but the error mentions the profile by name. This indicates to me that something somewhere is successfully locating the profile. So I am not sure why it isn't able to use it.
I get the error when I build at the command line using:
cordova build ios --device --buildConfig="build.json"
I would think I should be able to reproduce the issue by building in Xcode, but when I load the cordova project in Xcode and build it, it seems to be fine. But perhaps I am not doing the equivalent step in Xcode. I am just choosing to "Build" in Xcode. Perhaps there is another way to do the equivalent in Xcode?
This same codebase does build successfully on our build box, so this is undoubtedly a config issue here on my Mac. What do I need to do besides download and install the provisioning profile? I have done this both by downloading from Apple Developer and by directly installing through the Xcode preferences.
Below is the exact error I am getting:
Code Sign error: No codesigning identities found: No codesigning identities (i.e. certificate and private key pairs) that match the provisioning profile specified in your build settings (“[the name of our profile]”) were found.
I am a relative novice building an app developed by someone else. I have tried everything near the top of the Google search results for this error, but not much else. I am likely missing something obvious. Pointers and help would be greatly appreciated.
I had not installed the Enterprise distribution certificate with the private key here on my Mac. Once I did that it worked.

Resources