Search code examples
iphoneiosdelegatescllocationmanageruserlocation

How can I change text "App would like to use your current location?"


Can we change this text?

I have used property purpose of CLLocationManager class. But message did not change.

[locationManager setPurpose:@"Change text message"];

Any ideas?

Thanks,


Solution

  • Add a key in your info.plist like: NSLocationUsageDescription and add your string as it's value.

    iOS 8 and greater

    They introduced two more keys other than NSLocationUsageDescription

    1. NSLocationAlwaysUsageDescription
    2. NSLocationWhenInUseUsageDescription

    iOS 6 or greater

    NSLocationUsageDescription

    “Privacy - Location Usage Description”

    Specifies the reason for accessing the user’s location information. See “NSLocationUsageDescription” for details.

    iOS 6.0 and later

    Check this link for reference

    iOS 3.2 to iOS 5

    purpose

    An application-provided string that describes the reason for using location services. (Deprecated in iOS 6.0.)

    @property(copy, nonatomic) NSString *purpose Discussion

    If this property is not nil and the system needs to ask for the user’s consent to use location services, it displays the provided string. You can use this string to explain why your application is using location services.

    You must set the value of this property prior to starting any location services. Because the string is ultimately displayed to the user, you should always load it from a localized strings file.

    Availability

    Available in iOS 3.2 and later.
    Deprecated in iOS 6.0.
    

    Declared In CLLocationManager.h