Builds sent to TestFlight are rejected



Hello everyone. I am having an issue where I am building my app successfully and even successfully uploading to TestFlight. However after the upload I receive an email from Apple stating that the build has been rejected.
I am using Fastlane to build and deploy my app. Everything is set to use “Appstore”. I am calling “match” to handle certs and profiles, and then calling “gym” to build the app. Finally I am using “pilot” to deploy to testflight. The app has an app extension bundled with it.

Below is a copy of the email:

Dear developer,

We have discovered one or more issues with your recent delivery for “XXXXXXXXX”. To process your delivery, the following issues must be corrected:

Invalid Signature - The binary with bundle identifier ‘’ at path [AppName.appex] contains an invalid signature. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level). If you are certain your code signing settings are correct, choose “Clean All” in Xcode, delete the “build” directory in the Finder, and rebuild your release target.

Once these issues have been corrected, you can then redeliver the corrected binary.

Any help that anyone can give would be greatly appreciated! I have been stuck on this for days!