RSS feed icon

Updating Xcode Managed Provisioning Profiles

**Quick Tip**

TL;DR: clean out ~/Library/MobileDevice/Provisioning\ Profiles

Apple has been recommending automatic code signing for some time, and once Xcode 8 was released I am happy to say that most of its aspirations have been realized. My projects tend to have somewhat complex Build Configurations to support Integration, Staging, and Production builds of each app, so having most of the provisioning and cert madness automated is a big relief. Prior to Xcode 8, I was manually managing provisioning profiles for each configuration which can be quite a burden if frequent provisioning profile updates are made.

However, there is one issue that tends to trip me up: often I distribute internal Integration and Staging builds of apps to testers using Ad Hoc distribution (services like HockeyApp make this fairly painless). With Ad Hoc distribution, if new testers are added, their devices need to be added to a provisioning profile. No big deal right? Just use the Developer Center to add their devices, and boom! Xcode Managed Profiles will get them automatically.

Except, there is one caveat: when you go to build the project, an older “Managed Provisioning Profile” may already exist that Xcode can pick up instead of requesting a new one. Meaning your new build won’t be availble to your new, eager testers! Sad faces all around, and a bit of a long feedback loop.

A provisioning profile may exist on disk, you just can’t see it in Xcode

A provisioning profile may exist on disk, you just can’t see it in Xcode

The solution is simple: just make sure to remove any locally saved provisioning profiles, and Xcode will generate a new Managed Provisioning Profile containing your new testers’ devices.

rm -r ~/Library/MobileDevice/Provisioning\ Profiles

This could be taken further and added to a run script on release builds, however, you really only need to generate new provisioning profiles if something changes - and automated scripts that delete from the file system aren’t always a great idea 😷

Cheers! 🥃