Expiring Profiles Break Code Signing
Problem
For some time now I’ve had a problem every time my application profiles expire - I can’t build the application for the device, with the usual error:
Code Sign Error: Provisioning Profile ‘GUID’ cannot be found.
Each time this happens I forget how to fix it, but this time I cam across the following solution on a Blog at Frogameleon.
No amount if changing the profile in the build settings seems to have any meaningful affect, probably because the old profile looks a lot like the new one - I suspect the GUID isn’t being compared, but the profile name. I also suspect that my project is quite old, so newer projects might not exhibit this problem.
Solution
Your xcodeproj file is actually a package. Right-clicking on this allows you to ’show package contents’ as you might expect and you can then edit the project.pbxproj file by double clicking - it should open in Xcode. Once inside, you can search for the legacy GUID for your old profile - the one your project keeps looking for regardless - and replace it with the GUID for your new profile.
Save the file, re-open the project (you didn’t edit it with it open now did you?) and Robert’s your Dad’s brother!
Enjoy! And if you don’t I’ve at least documented this process somewhere I can find it for when this next happens!