I am seeing this message, too often when I try to refactor my code by renaming:
***.h is not part of the build phase of any targets in this workspace and so can’t be refactored.
Add the file to the build phase of a target in this workspace, or make a selection in another file.
Sometimes, refactoring works only right after relaunching Xcode and reopen the project. But it’s not working afterwards.
Not succeeding in finding the right solution, I dealt with this situation by repeatedly deleting Derived Data in Organizer > Projects