V
V
Vitaly2016-12-30 15:54:46
Objective-C
Vitaly, 2016-12-30 15:54:46

How to execute code to get location after request for geolocation permissions?

All the best. I'm trying to get geolocation using locationManager .
In the info.plist file , I included a request for permissions.
I want to get the data as soon as the application starts, but here's the catch, my code for getting location data works faster than a request for permissions, as a result, when the program is first launched, the coordinates are 0. Where is the right place to execute the code to get the data?
P.S. In the simulator, for some reason, I don’t always get the coordinates, although in Product -> Scheme -> Edit Scheme ... -> Options I checked the Allow Location Simulation checkbox, and also selected the city

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bananafish_911, 2017-01-05
@Bananafish_911

CLLocationManager reference:
Briefly in Russian: CLLocationManagerDelegate has a method locationManager(_:didChangeAuthorization:)
This callback will be called after asking the user for permission to location services.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question