I know this has been asked and answered multiple times but I\'m tearing my hair out as none of the proposed solutions appears to work.
After wasting my half day I got this working.
Select Target > Edit Scheme > Select Run > Change Build Configuration to debug
+1 to banging my head against the wall for a day or two...
Also check this setting:
Build Settings -> Code Signing -> Provisioning Profile
After following the above steps, "Automatic" setting worked for me. ~kjm~
It happened to me when I accidentally left the build in release mode.
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting
-> General
-> Date & Time
-> set time automatically
If it does not work then set time automatically of both mac & iPhone, it may work fine.