Fixing iOS distribution certificate related errors

When trying to deploy my app with Fastlane to the App Store, the commands have failed citing certificate related errors such as:

error: exportArchive: No profiles for 'com.company.appname' were found
Error Domain=IDEProfileLocatorErrorDomain Code=1 "No profiles for 'com.company.appname' were found" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=No profiles for 'com.company.appname' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS App Store provisioning profiles matching 'com.company.appname'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.}

I also had errors citing missing an "iOS Distribution" certificate. Most results online will refer back to Fastlane's new tooling called match, which they are heavily marketing.

However, this tool is made so that a team of developers share up to date certificates. I'm by myself, this is not my use case.

Eventually, I resorted to trying to manually building a signed build of my app for App Store distribution through XCode. Their UI was great and walked through the process of creating the right certificates.

Here's the full guide at https://help.apple.com/xcode/mac/current/#/dev067853c94.

After I successfully built my first app signed for App Store distribution, I re-ran the fastlane command and it found the certificates correctly.