2

I am using core location framework to collect the device location in my iOS app. When i install the app for the first time in device, iOS asks for the user permission with a alert view as below.

App screenshot user permission

Is there any way to disable this default alert view and display a customized message to the user?

Rashmi Ranjan mallick
  • 6,390
  • 8
  • 42
  • 59
  • possible duplicate of [Replacement for "purpose" property of CLLocationManager](http://stackoverflow.com/questions/12562152/replacement-for-purpose-property-of-cllocationmanager) or see http://stackoverflow.com/questions/18473265/how-to-change-text-in-nslocationusagedescription – rmaddy Nov 25 '13 at 16:05
  • @rashmiRanjan you can set purpose message programatically. See answer – Bhumeshwer katre Nov 25 '13 at 16:08
  • @Bhumeshwerkatre That is deprecated. – rmaddy Nov 25 '13 at 16:09

3 Answers3

4

I added screen shot where to add purpose message.

enter image description here

Bhumeshwer katre
  • 4,671
  • 2
  • 19
  • 29
  • This has been deprecated since iOS 6. – rmaddy Nov 25 '13 at 16:08
  • OK. But instead of posting this answer, you should flag the question as a duplicate. – rmaddy Nov 25 '13 at 16:30
  • The answer provided is valid for ≥ iOS6. See https://developer.apple.com/library/mac/documentation/general/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html – maethorr May 10 '14 at 07:22
2

Those alerts are system generated and not editable by the developer. If they were editable, then the developer could change the meaning or make it not obvious to the end user what permissions they were asking for.

Mark S.
  • 3,849
  • 4
  • 20
  • 22
  • This is incorrect. You can customize the message by setting a value in the Info.plist. – rmaddy Nov 25 '13 at 16:02
  • @Maddy: Can you please tell us how to do that in info.plist file? – Rashmi Ranjan mallick Nov 25 '13 at 16:04
  • Using the NSLocationUsageDescription setting, [description here](https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html), will add a note to the existing dialog box. But, you cannot disable or change the wording of the existing alert (as was asked). – Mark S. Nov 25 '13 at 16:11
  • @MarkS. The OP asked how to change the message. The setting lets the user change the message. – rmaddy Nov 25 '13 at 16:32
0

For user privacy reasons, this prompt/alert is system generated and you can't disable it if your app uses core location.

Having said that, however, you can delay the display of this alert in your app by organizing your code flow such that location services are only called when needed (lazy initialization).

As per apple docs, read notes under method -

+ (BOOL)locationServicesEnabled

Location services prompts users the first time they attempt to use location-related information in an app but does not prompt for subsequent attempts. If the user denies the use of location services and you attempt to start location updates anyway, the location manager reports an error to its delegate.

Ashok
  • 6,224
  • 2
  • 37
  • 55