Q:

Fastlane certificate error

I'm starting to have an issue with fastlane.  When I run a custom lane that runs pilot the app starts to compile but eventually terminates with an error.  In the fastlane log I have: 
Provisioning profile "match AppStore com.mycompany.myapp-test" doesn't include signing certificate "iPhone Developer: Bob Trotter (XXXXXXXXX)". 
Code signing is required for product type 'Application' in SDK 'iOS 10.0'.  

I have logged into the apple developer website.  Gone into the provisioning profile and added myself.  I have tried doing a project clean and downloading the certificates in xocode.  I have also run fastlane certs.  Any idea what I am doing wrong here?  Any pointers on this would be great!! 

A:

It seems that you are trying to use pilot with a developer certificate. 
As pilot is used to submit your app to TestFlight and subsequently to ApStore, it seems consistent that the error message saying match AppStore ... for the provisioning profile and iPhone Developer: ... for the certificate would generate errors. 
It looks like you are setting the correct provisioning profile but not the correct certificate to match.  You can check that on XCode by going to you project target -> Build settings -> Code Signing Identity (Release) and selecting iPhone Distribution

If you are using cert you might as well create Distribution certificates, which your App Store provisioning should be matching. 
Alternatively (and personally my option of choice today) you can use match to create you provisioning profiles for both development and distribution, which will also configure your sigh environment variables to be used by XCode. 
Based on your example bundle identifier, you could do this by executing the following command(s)
$ sudo gem install match
$ match appstore -a com.mycompany.myapp-test

