Search code examples
iosxcodecode-signingprovisioning-profile

Having test app provisioning profile not expire


I have an iOS app that I'm testing on my phone. I installed it through XCode. I've had the app on my phone for several weeks. After a couple of weeks the app no longer works. If I open the app it immediately closes. If I do a fresh re-install of the app, then everything works for a couple more weeks till it breaks again.

My theory is that the provisioning profile I used has expired, preventing the app from loading. This is expected as I'm installing the app through XCode and Apple probably doesn't intend for users to have a test build used on an iOS device for extended periods of time. My question is this, how can I set it so the provisioning profile doesn't expire? How would I need to adjust the code signing settings to adjust for this?


Solution

  • You cannot set provisioning profiles to never expire. Development provisioning profiles will expire after a set amount of time. For a free developer account with Apple, your profiles will be set to expire after 30 days. If you have a paid developer account, the profiles will last for a year from when it is created. Note that a new profile isn't created every time you build, so you have to keep an eye on the profile expiration date and generate a new one when you get to 10 months or so.

    Apple will not let you go longer than this, as it would allow / encourage other distribution mechanisms. If developers could build an app and distribute it to other peoples' devices, and those apps could run indefinitely, someone would quickly develop a 3rd party app store and Apple would lose control of its ecosystem.

    FYI - If a provisioning profile expires, the app will launch briefly, then shut down when iOS realizes that there is a code signing problem (also happens if your certificate has been revoked or has expired). You can check for sure by plugging the device into your Mac and monitoring the device console when you attempt to launch the app. You will likely see a code signing error in the logs.