I understand there can be many reasons for this error message. Xcode needs a distribution profile with the same Bundle Identifier as the app. Even though this seemed to have worked in the past, Xcode 4.6.3 has gotten more pernickety as of late.
Let’s fix this.
Head over to the Apple Provisioning Portal and under Provisioning Profiles, select Distribution.
Select the Plus Button to add a new profile. Select App Store under Distribution and hit continue.
Next you’ll have to select the App ID for your project. Once selected, hit continue and give your new Distribution Profile a name (I’d use the name of your app). You’ll pre prompted to download the profile on the next screen.
Note that this isn’t necessary as Xcode can import those automatically – let’s do that next.
Back in Xcode 4.6.3
Open the Organiser (under Window) and select Devices. Under Library, find Provisioning Profiles and see a (probably very long) list of currently installed profiles. At the bottom right of that screen there’s a Refresh button – click that and Xcode will talk to the Provisioning Portal, importing and updating all profiles in this list. Your new one should have been added to the list after a few seconds.
Now quit Xcode and restart it
This is crucial for the automatic profile selector to refresh – otherwise your new profile won’t show up for selection. Don’t ask! I’m sure it’ll all be “so much better in Xcode 5” (yeah right). Anyway…
Select your project’s Big Blue Bar (I’m not sure what it’s called, the one above the target) and select Build Settings. In here, find the Code Signing section – you can search for it at the top right or just scroll down. The block you’re looking for looks like this:
Select your Developer Profile for the first two options, and your newly created Distribution Profile (with matching Bundle ID) for the latter two, just like in the screenshot.
Head over to Product – Build and with a bit of luck the error should have gone.