Testing Permission Dialogs (Address Book, Calendar, etc)

If you’ve ever worked with iOS API’s that require user permission (Calendar, Address Book, Photo Library, etc), you know how difficult it can be to test the permissions alert view (dialogs) that appears to the user.  The alert typically only appears once to the user; after that, the system remembers the user’s response forever.  Even uninstalling the app doesn’t reset the prompt, as the device remembers the app’s settings upon reinstallation.

Apple does have a solution to this problem: you can reset the privacy prompts within iOS Settings (General > Reset > Reset Location and Privacy).  Unfortunately, this reset is device wide.  If you’re developing and testing on a personal phone, all your apps will start to prompt you for permissions again.  This is, well, annoying.

An alternative is to change the app’s Bundle Identifier during testing.  This will force the OS to treat the app as a brand new application (even though nothing else in your app has changed).  Changing the Bundle Identifier is as simple as opening the plist file and appending a string to what’s already there.  Use numbers so you can simply increment any time you need to retest something.

testing permission dialogs in iOS

Note that with this trick, the OS truly thinks your app is a brand new app.  This means it will install a new version of your app along side the previous version.  If you aren’t careful, you can lose track of which app version is which.  In addition, don’t forget to set the Bundle Identifier back to it’s original state when you’re done testing.


Mike Oliver has been a mobile junkie every since his first “Hello World” on a spinach-screened Blackberry. Lately, he works primarily with iOS, but he’s always looking for new ways to push the envelope from your pocket. Mike is currently the Lead iOS Engineer at RunKeeper, where he tries to make the world a healthier place one app at a time.
  1. I read somewhere that iOS forgets your previous permissions if you leave the app uninstalled for more than 24 hours, though I can’t find the link and I can’t recall if I ever put it to the test. Still not exactly convenient though, even if true.

  2. It’s not an easy solution. You have to register new appId
    and create new provision profile to be able to run an app on a
    device. It’s not just edit your bundle identifier.

Comments are closed.