Xcode5 has broken this again (congratulations to Apple for failing to bother testing one of their buggiest bits of code. Again).
A new way to break/fix it:
If you have:
- An old profile on your device (team profile, or non-team profile)
- A new profile generated automatically on the App Store, by any copy of Xcode5, even if it's simply an update to the profile you already had
- (NB: if any colleague adds themself to the profile, this triggers the above "change")
- You use the new "Accounts" dialog to download profiles (NB: this is now REQUIRED by Apple for various situations - all other approaches, including manual download, appear to be unsupported. Even though the Apple Developer site TELLS YOU TO MANUALLY DOWNLOAD! Don't do it! It breaks Xcode5!)
- Xcode5 will INCORRECTLY hide AND RENAME that profile in the drop-down selector in Build Settings
- (I detest this drop-down. Some idiot at Apple keeps removing information from it, and someone else keeps adding it back, it flip-flops between Xcode point releases. WHY??!?!)
- There is NO WAY you can select the correct profile - whatever you select, Xcode5 will use the wrong one
The solution is easy enough. The "Apple engineering are lazy" solution:
- Go to Xcode5 -> Window -> Organizer -> Devices
- Select your device
- Select provisioning profiles
- Delete everything relating to your current project and/or Team (even other projects, if necessary - they can all be downloaded later if still needed!)
- Re-build.
- You should get an error from Xcode5 that the profile doesn't exist. Even though you manually had seleted the profile that was ALREADY PRESENT on your machine (yep - that dropdown is buggy again. It lies about the profile it selects behind the scenes!)
- In the profile selector, select the "real" profile
- Build, run - success!