Xcode signing works but fastlane does not - ios

I've successfully built a cordova to ios app and signed it with a certificate. On my machine the certificate is `9********. When I try build with xcode it signs fine. When I run fastlane beta with
build_app(
# scheme: "YourScheme",
export_method: "ad-hoc",
export_xcargs: "-allowProvisioningUpdates"
)
I get the build errors
[15:10:52]: Certificate X******** (iOS Distribution) can't be found on your local computer
[15:10:52]: Certificate 8******** (iOS Distribution) can't be found on your local computer
[15:10:52]: Certificate C******** (iOS Distribution) can't be found on your local computer
Obviously these aren't even the same certificates as the one installed on my machine. Why isn't fastlane finding the one on my machine and why is it looking for these?

I have figured this out (sort of). The trick was revoking one of the certificates in the developer console and then allowing fastlane to create a new cert on my machine.

Related

"A valid provisioning profile for this executable was not found" for Xamarin.Forms iOS RELEASE build to an iPhone Device

So my certificates recently expired, and I had to create new ones. I created both an Apple Development and an Apple Distribution certificate from Visual Studio and they both show up as valid and/or in keychain in Apple Developer, Visual Studio, and Xcode.
I of course updated the app's development and distribution profiles to use these new certificates and made sure to re-download them to my workstation.
The iOS component of the (Xamarin.Forms) app can deploy the Debug build to both a simulator and a real device. It can also deploy the Release build on simulators. Archiving a build for publishing also worked fine. It uploaded on TestFlight and was successfully installed by a tester.
The issue is only with deploying a Release build to my test device. The Release build has been deployed successfully to this same device before, so I am very unclear as to what has happened.
The bundle signing identity and provisioning profile were set to automatic as recommended. To make sure the bundle was using the correct profile, I set them instead to the expected/correct distribution identity and profile, and the deployment still fails.
The app did use to have an iOS Distribution certificate, but that seems to have been replaced by Apple Distribution as far as I can tell. I see that iOS * certificates can still be created on Apple Developer, but they're not listed as options when creating certificates from Xcode or Visual Studio for Mac. I did try pointing the provisioning profile to an iOS Distribution certificate created online, and it still did not work.
I've also restarted Visual Studio, Xcode, the iPhone device, and my Mac workstation to no avail.
Is there something else I could be missing? I am new to app development and am very unclear as to what else "invalid provisioning profile" could mean.
Any additional help/tips/ideas would be appreciated!
Error message when deploying:
ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.FSRtzC/extracted/{XAMARIN_IOS_PROJECT_NAME}.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)
error MT1006: Could not install the application '{PATH TO XAMARIN_IOS_PROJECT}/bin/iPhone/Release/{XAMARIN_IOS_PROJECT_NAME}.app' on the device '{IPHONE DEVICE NAME} iPhone': AMDeviceSecureInstallApplicationBundle returned: 0xe8008015.
Application could not be uploaded to the device.
Provisioning Profile Info:
Status: Active
Type: App Store
Enabled Capabilities:
Associated Domains, Game Center, In-App Purchase, Push Notifications
Software Versions:
Visual Studio Community 2019 for Mac
Version 8.6.5 (build 23)
Apple Developer Tools
Xcode 11.5 (16139)
Build 11E608c
Xamarin.Mac
Version: 6.18.2.1 (Visual Studio Community)
Xamarin.iOS
Version: 13.18.2.1 (Visual Studio Community)
iPhone 7 Plus running iOS 13.5.1
I simply had to use a Distribution Profile of type Ad Hoc. The Distribution Profile the app was using was of type App Store as it was what was needed to create a build archive for Test Flight.
I do wish the error message had been more informative and less generic. Multiple types of issues seem to result in the same error message.
Useful References:
This provides useful info about using the Device Log and debugging Entitlements that helped me start getting somewhere. My custom Entitlements and enabled Capabilities for the Bundle Identifier matched, so I couldn't figure out what else to try initially. The Device Log gave me no info, but taking out the Entitlements file worked, and it went from there.
This reassured me that my one custom entitlement that's different between Debug and Release mode, APS Environment, is using the correct value of "production" even though it was causing the installation to fail with the (then App Store) Distribution Profile.
This provides detailed explanation on each Provisioning Profile Type.

Fastlane match with multiple existing apps in a corporate environment

I'm having trouble with the basic understanding of iOS app signing and getting these apps ready for testflight and deployment using Fastlane.
I've been to tasked to automate the deployment steps of apps we have and we have an Ionic Cordova setup currently that was used to build iOS and Android projects for 18 different apps that are currently on the app store, but I'm looking to streamline the whole process using Fastlane and I'm stumped at the Certification stages of the process.
I've no access to the existing apps private keys or know how to go about setting up the project using Fastlane as I keep receiving the errors shown below.
I've tried to follow the concepts on Fastlane Codesigning concepts, using the Fastlane projects (cert, sigh and match) and following https://codesigning.guide/ while still making no progress.
How can I go about setting up the certs on the Mac to enable it to build and push the apps to Testflight and pushing the apps fundamentally to the app store?
Thank you
Errors Recieved
Could not create another Distribution certificate, reached the maximum number of available Distribution certificates.
Could not find the newly generated certificate installed fastlane
Security find-identity -v -p codesigning return 0 valid identities found
You already have existing distribution certificates, you will have to revoke them via the developer portal or automatically via fast lane with:
fastlane match nuke distribution
BE WARNED: this will remove all certificates and provisioning profiles for distribution (development or enterprise is unaffected). Apps that are already released to the App Store and ready for sale are UNAFFECTED, this only affects packages you sign for the App Store and submit with OLD certificates, but since you have no access to them you are fine anyway.
fast lane can then create its own when you invoke it (its fairly automated).

No installed provisioning profiles match the installed iOS signing identities

I am attempting to launch my test app to a real iOS device through iOS xamarin. However, upon building or deploying, the error notes:
No installed provisioning profiles match the installed iOS signing identities
I have followed every step concerning creating certificates for the app, partitioning devices, creating an apple developer account and linking to Xcode, yet this error persists...
update:
I revoked the certificate an recreated the provisioning file, now downloaded through Xcode. However, Xamarin can now build, but not deploy out to my iPhone as there is no Run option:
How can this be alleviated?

Visual Studio Tools for Cordova - RemoteBuild for iOS fails

Does anyone have idea what this error in VS means:
1> Check dependencies
1> No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "xxxxxxxx" with a private key was found.
1> Code signing is required for product type 'Application' in SDK 'iOS 10.0'
App runs fine in simulator but I can't deploy to phone. I have both development and distribution certificates on Developer pages and imported in Keychain. Also, provisioning profiles for com.companyname.appname are added and downloaded with Xcode 8.
Where this "iOS Development" signing certificate must me present? Are there any additional settings that need to be configured for RemoteBuild (I guess that is fine since I can deploy to Simulator). My Macbook Pro is running El Capitan.
Where this "iOS Development" signing certificate must me present? Are there any additional settings that need to be configured for RemoteBuild (I guess that is fine since I can deploy to Simulator).
I guess you downloaded an existing Certificate from the Developer Page directly, which won't generate a private key in your Mac.
So to solve the problem, you need to find the private Key that paired with this Certificate(usually in the original Mac that request this Certificate) and export the Certificate(.p12 file) to your current Mac computer. For details, please refer to Export your iOS Certificate and Provisioning Profile.
If you can't find the private key, you need to request a new Certificate, and the private key will be generated automatically in your Mac. For details of requesting a new Certificate please refer to this case.

Transitioning to Fastlane Match Duplicate Certificates CI

I am trying to transition my team to using Fastlane Match. I have it working on my local machine, but not on our CI (jenkins) machine. Our CI machine still has the old certificate installed on it and I assume this is causing the issue. When running through CI I get the error:
Code Signing Error: Provisioning profile "match InHouse >bundle id<" doesn't include signing certificate "iPhone Distribution: >org<".
My best guess is that gym is picking up the wrong cert when trying to verify the provisioning profile because both certs have the same name.
Is there a way to specify which cert to use by id or expiration date when archiving the build from gym/xcodebuild?
Deleting the old certificate is not a viable option because, as of now, we still need the old cert until our fastlane build is 100% stable and everyone has transitioned to using it.
Thanks!
Yes you can specify which cert to use in one of two ways:
In your fastfile with the export_options and provisioningProfiles option:
.
gym(
...
export_options:{
compileBitcode: false,
signingStyle: "manual",
provisioningProfiles:{
"com.myapp.iosapp": "match AdHoc com.myapp.iosapp"
}
Or in Xcode's Build Settings, by setting each of the certs manually:

Resources