A valid provisioning profile for this executable was not found for debug mode

It could be because your iphone is not recognized by the provisioning portal.

Solution:

1) In Xcode, Goto --> Build --> clean all targets.

2) In "Groups & Files" -->Target --> expand it --> right click your app and select Clean "your app"

3) Goto->Window-->Organizer

4) In the Devices tab on the left, select your iphone

5) In the Provisioning section of the selected iphone delete all the current profiles (if any)

6) Unplug your iPhone and replug it in.

7) Goto->Window-->Organizer-->right click your iPhone -->Add device to provisioning portal

8) Now make sure you have selected the appropriate code signing identity in edit project settings -> build --> code signing

Build and run. Good luck!


In Xcode 10, I solved this by switching the project's build system from "new build system" to "legacy build system" (File -> project Settings).