RAM RAM - 1 year ago 67
Objective-C Question

Can I get location access without generating the default popup in iphone?

I am working on an app that requires location access. I created a view controller asking the user to allow or not with 2 buttons. But when I click the allow button, device is generating it's own popup asking the user for location access. Can I avoid the popup and just add the functionality of allow in popup into my code for the allow button in my app itself?

Answer Source

No you cannot avoid system popup. As per apple

Always request authorization at the point where you actually plan to use location services to perform a task. Requesting authorization may display an alert to the user. If it is not clear to the user that your app is using location services for a useful purpose, the user may deny your request to use those services.

Also, It is safe to start location services before the authorization status of your app is determined. Although you can start location services, those services do not deliver any data until the authorization status changes to authorizedAlways or authorizedWhenInUse. To be notified when the authorization status changes, implement the locationManager(_:didChangeAuthorization:) method in your location manager delegate.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download