Check your both your project debug setting and release setting pages for the following:
There is a bundle id setting for when you build for "debug" (i.e test on your phone) and another bundle id setting for when build for "release".
If you have two different apple accounts, your bundle ID will be attached to only one of the apple accounts (it cant attach to both).
So one cause of the problem is that the "Team" dropdown box setting for "debug" is different to the "Team" dropdown box setting for "release" Makes sure the "Team" dropdown box in your project settings is set correctly on both pages.