Skip to content

Instantly share code, notes, and snippets.

@jmoody
Created February 10, 2015 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmoody/c9964409aa08d9d7df0e to your computer and use it in GitHub Desktop.
Save jmoody/c9964409aa08d9d7df0e to your computer and use it in GitHub Desktop.

The problem is that this kind of UIAlert appears before Instruments can take control of the app.

In some cases, applications that ask for location services, access to contacts, access to photos, etc, immediately after the app is launched are violating the Mobile HIG guidelines.

Quoting the HIG

Ask permission at app startup only if your app can’t perform its primary function without the user’s data. People will not be bothered by this if it’s obvious that the main function of your app depends on knowing their personal information.

Avoid making programmatic calls that trigger the alert before the user actually selects the feature that needs the data. This way, you avoid causing people to wonder why your app wants their personal information when they’re doing something that doesn’t appear to need it.

For location data, check the Location Services preference to avoid triggering the alert unnecessarily.

If your app's primary function cannot be achieved without access to Location, Contacts, Photos, etc. then consider add a small delay before triggering these alerts.

If this is not acceptable in your production app, then consider using a compiler macro that confines the delay for the *-cal target.

In some sense I consider this a feature of Calabash - it is exposing a potential problem (a HIG violation) in apps.

If all else fails you can try this gist:  https://gist.github.com/jmoody/523123326f8e20dfdf0c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment