I updated my provisioning profile to include some more devices for Ad-Hoc testing,I added this new profile and removed the old and now I am getting this error:
I also had this problem while trying to replace a dev provisioning profile with an updated version. Looks like a bug.
Running XCode clean, then setting the code signing identity (for dev, in my case) to "don't code sign", then setting the code sign identity back to the relevant development provisioning profile resolved the build error.