How to Get a Crash Log Due to Expiration of Provisioning Profile

Is it possible to get a crash log due to expiration of provisioning profile?

If the app's provisioning profile has expired, you will see it in the Device console. If you have access to the device, plug it into your Mac and fire up Xcode.

Starting with Xcode 6, to view the console output of a connected device:

Connect your device.
Build and deploy the app to the device using either the CLI or Studio.
Sync the application to the device using iTunes (if you are not building directly to device).
Launch Xcode.

Open the Devices window. From the menu, select Window > Devices.

Select your device from the left bar.

Click the Show the device console button ( expand icon ) to expand the console.
device console

Once you have the console up, click the trash can to clear it, then on the device try to launch the app. If the provisioning profile for the app has expired, I believe you will see a message like the following:

A valid provisioning profile for this executable was not found

Checking for provisioning profile expiration

Here is a python script that will abort the build if the provisioning profile expires in less than 15 days. This script is meant to be run as a build phase script.

Note that this script will also work when run as part of an Xcode Bot integration.

#!/usr/bin/python

import glob, os, plistlib, subprocess, sys
from os import path
from datetime import datetime

def read_mobileprovision(mobileprovision_path):
# From http://stackoverflow.com/questions/6398364/parsing-mobileprovision-files-in-bash/10490095#10490095
return plistlib.readPlist(subprocess.Popen(['security', 'cms', '-D', '-i', mobileprovision_path], stdout=subprocess.PIPE).stdout)

if os.environ['PLATFORM_NAME'] != 'iphoneos':
sys.exit(0)

provisioning_profiles_dir = '/Library/Developer/XcodeServer/ProvisioningProfiles' if os.environ['USER'] == '_xcsbuildd' else path.expanduser('~/Library/MobileDevice/Provisioning Profiles')
provisioning_profile_uuid = os.environ['EXPANDED_PROVISIONING_PROFILE']
mobileprovision_path = path.join(provisioning_profiles_dir, provisioning_profile_uuid + ".mobileprovision")
if not path.exists(mobileprovision_path):
for mobileprovision in glob.iglob(path.join(provisioning_profiles_dir, "*.mobileprovision")):
if read_mobileprovision(mobileprovision)['UUID'] == provisioning_profile_uuid:
mobileprovision_path = mobileprovision
break

print(mobileprovision_path)

expiration_date = read_mobileprovision(mobileprovision_path)['ExpirationDate']
print("Expiration Date: {}".format(expiration_date))

remaining_days = (expiration_date - datetime.now()).days
print("Remaining Days: {}".format(remaining_days))

if remaining_days < 15:
sys.exit("error: Provisioning Profile {} is expiring in {} days.".format(mobileprovision_path, remaining_days))

What to do if a Distribution Provisioning Profile has expired and I want to update my app?

Juste create a new certificate, as long as you do not change the bundleID you should be able to send the update.

When you create a new or renew an appstore provisioning profile you can select the new certificate and you are good to go.

Enterprise Distribution Provisioning Profile Expiration

So generating a new provisioning profile will not invalidate any of the apps out there on devices. Simply generate the new provisioning profile, build a new version of the app with the new provisioning profile, and just make sure all your users / testers update to the new version of the app.

Alternatively, you could generate the provisioning profile and then distribute the profile to all the devices through MDM (if you're using an MDM solution) or by email (not a great experience). Basically the app will continue to run as long as the new provisioning profile gets on the device before the old one expires, whether that's through MDM, manually, or by installing a new version of the app with the provisioning profile in the .app payload. Or if your users download any app with the new provisioning profile, assuming that provisioning profile is set up with a wildcard app ID, that will also correct it (see information about that here: https://stackoverflow.com/a/29121777/3708242).

Basically, you need to do something before the provisioning profile expires (the sooner the better) and get that new provisioning profiles on the device (through one of the options above).

What will happen when iOS provisioning profile will expire

The app that already installed on the devices would not open, it would crash on launch.

App would not be able to install on new devices.

That apply only for an app that has been distributed outside of Appstore.

If the app was downloaded from Appstore and you invalidate/expire it's Appstore certificate, nothing would happen to it.

Xcode crash when refreshing provisioning profiles

Here is apple's official workaround:

Run this command in terminal:

mkdir ~/Library/Developer/Xcode/OldPortalDBs; mv ~/Library/Developer/Xcode/connect1.apple.com* ~/Library/Developer/Xcode/OldPortalDBs

Worked like a charm for me.

iOS app crashes at launch because of distribution profile? (libgdx + robovm)

Answering to myself, it might help others to know that despite this build crashing on any device, it was approved by Apple a couple of hours ago.
So if you have the same problems described here, triple check everything one last time, your build will crash but it can be approved by Apple.
It is just a pitty that with Libgdx Robovm, it is either impossible or very difficult to use XCode to check provisioning profiles and certificates, so you basically have to take a leap of faith...
Hope it helps



Related Topics



Leave a reply



Submit