Xcode 8 A valid provisioning profile for this executable was not found

ATTENTION!

Who should read

If you were developing with a "Personal Team" and is switching to a paid team, then you'll get this error if you have not updated your other targets as well.

The cause

Since I'm using react-native, I happen to have a target for test (i.e. a target called appTests), and switching the team just in one target wasn't sufficient, and leads to this error. This error isn't informative enough to let you know there's an error in one of the targets, therefore leading to a long debugging time for myself.

Solution

1) On Xcode 9, go to every targets and update the team!

2) Unfortunately, the next steps aren't very reliable from my experience, you might have to do your best to clean the caches.

3) Stop every single running scheme/application by using the stop button

4) Go to Product -> Clean and cleans every schemes you use.

5) Quit and Restart Xcode

6) Run again and hopefully it works! If not, it's likely some cache are still present.


You can't install a build that was signed with the app store distribution provisioning profile and certificate (I'm assuming your release scheme is set to use your app store cert and profile). It will fail to install on the device if you try. You need to use either a development profile, or an enterprise distribution profile to install on test devices. The iOS Distribution certificate can only be used to build an app that will be installed via the App Store.


Thats a conflict of Xcode. The way I solved it is by deleting the derived data of Xcode.

Xcode > Preferences > Locations

You will see an arrow right from the path of the DerivedData which will open them in finder. Just erase everything in the folder.

Update: According to Chandler's comment check if there is a need to delete the test target.


I solved it by changing the build system to legacy in Xcode 10

File > Workspace Settings > Set Build system to "Legacy Build System"


It works when I also add the correct signing for myProjectTests. This was the last thing I did after trying all sort of solutions for 5 hours.