Search code examples
iosprovisioning-profile

Is there a way to limit an adhoc or debug iOS build to run for a specific time frame only?


For iOS apps, is there a way to limit an adhoc or debug build to run for a specific time frame or revoke its use whenever we want? Is it possible to make a specific device not able to run the app whenever we want?


Solution

  • Provisioning profiles expire after a year. You can revoke the private key behind the profile but this will disable all apps signed by that key for all users. You can't do it f or a specific user.

    In your app's source code you can do something like:

    if (askServerIfUserIsBlocked()) {
      alert("You can no longer use this app.");
      exit(0);
    }
    

    Which is fairly common in a beta release, for example if a newer beta is available for testing you might force all users to update. There is no way to uniquely identify each tester from within the app, Apple doesn't allow apps to access personal information. However you can always ask the user to enter their name or email address the first time they launch the app, and check with a server if they're allowed to use it.

    However if you want absolute security, no — it's not possible. Any user who has a copy of your app can modify it.

    If the provisioning certificate is revoked, they can sign it with a different developer certificate. If there is some code that terminates the app half way through launch they can modify the binary to add || false to the if statement.

    Once the software is running on a device controlled by someone else, you no-longer have any control over what they do with your app.

    EDIT:

    Also, Apple made many improvements to adhoc/debug deployment at last week's WWDC. I haven't checked out the session videos yet, but you should. There might be new options available.