I got this error when I accidentally modified the code signing identity build setting at the target rather than the project level. Make sure that you have the correct information entered at the project level (get info on the project, rather than the target.) If you changed the target build settings, try deleting the values from there. The target will then inherit the project's setting.
I would also do a "clean all", then exit xcode, delete everything from the build folder and try to do another build. (This is an Xcode voodoo trick that seems to solve many code signing issues.)