I have an Xcode workspace with unit test targets. The unit tests run fine in the simulator, and also run fine on one of my devices (a 4th-gen iPod touch running iOS 6). However, on two other devices (an iPad Air and a 5th-gen iPod touch running iOS 7), when I try to run unit tests I get an alert saying
A valid provisioning profile for this executable was not found
I only get this when running unit tests. If I try to Run the app on these devices, it installs and runs fine.
I have verified that the (developer) provisioning profile set in the Code Signing build settings for the app includes these devices and that it matches my developer code-signing identity and the App ID. I have also tried recreating, re-downloading, and re-installing the profile.
Where should I look? Why would the provisioning profile for Test not be valid when it is valid for Run?
I was running into similar error when installing app to iPhone 5 & iPhone 6. The same app install just fine (using Xcode 6). But it kept giving me errors like:
A valid provisioning profile for this executable was not found
The code signing and profile setting were good and valid. I tried different ways people have suggested but none of them solve my problem. If you are running into the similar problem when trying to run your app on iPhone 5 & above, and getting the error message, here is what you can try:
1) Go to apple developer web site and add the device (iPhone 5/6) to the development device list;
2) On the same web site, click on Provisioning profile and download development provisioning profile to your local computer;
3) Go to Xcode -> Devices, right click on the iPhone you want to run your app (which you added it to your development device list on apple developer web site);
4) Select "Show Provisioning Profiles". A popup window will show the profiles for the device. Click on "+" sign and select the provisioning profile you just downloaded.
The profile will be installed for this device and you are ready to go.
I have found this procedure works whenever you want to add a new phone for development.
After a lunch break, I figured this out: The Bundle Loader setting for the unit-test target was not referring to the application target I thought it was. It was, in fact, pointing at a target with an invalid provisioning profile.
It's interesting that the unit tests did run on an iOS 6 device, even with the incorrect profile. I guess iOS 7 does some additional verification.