Question

Instead of system default below popup for core location permissions, how can I use my default pop up for my app?

enter image description here

And when does this popup come? Is it coming on particular delegate Method?

Is there any way to disable that?

Was it helpful?

Solution 2

This popup comes when you access this locationServicesEnabled property of CLLocationManager.

[CLLocationManager locationServicesEnabled];

You can handle this in your app. But anyway, you cann't handle it first time according to apple's doc(see locationServicesEnabled topic.

locationServicesEnabled

Returns a Boolean value indicating whether location services are enabled on the device.

+ (BOOL)locationServicesEnabled

Return Value YES if location services are enabled; NO if they are not.

Discussion The user can enable or disable location services from the Settings application by toggling the Location Services switch in General.

You should check the return value of this method before starting location updates to determine whether the user has location services enabled for the current device. 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.

After disallow, try to attempt,

if ([CLLocationManager locationServicesEnabled)
{
    //Do your work
}
else
{
   if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized)
        {  //Show Alert view... }
}

OTHER TIPS

You can not replace that UIAlertView but cutomize the text to hopefully explain better why your app needs access to the user's location.

See https://stackoverflow.com/questions/12562152/replacement-for-purpose-property-of-cllocationmanager

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top