Greetings, at once I apologize for the errors or the question that was not very correctly asked. And so the question is that in order for me to get data on geolocation, I need to wait about 0.5-1 sec. Should I use the code below or how to do it correctly? Or it is worth putting somehow a condition on data acquisition. (not yet received data, do not execute the following code ..) Completely confused ...

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ [NSThread sleepForTimeInterval:2.0f]; }); 

Function call time

  • You should not stop the entire application for two seconds, but start performing the location in two seconds. see performSelector: afterDelay developer.apple.com/reference/objectivec/nsobject/… - by Max Mikheyenko
  • Thanks @MaxMikheyenko by the way for the last question with latitude and longitude, I saw that you managed to add a new branch to my application. So if I run the location in two seconds, the method that updates the data on the screen will get empty values. It turns out how. Launching Application 1 The method is launching geolocation and then receiving data from the server and then updating the label on the screen. But only after calling the label update method, geolocation comes in fact with a delay and is no longer needed. Sloppy wrote of course ... - rem0t
  • one
    that is, you need to do something else after updating the location? then just all the code that should be executed call from didUpdateLocation or didUpdateLocation it is called - Max Mikheyenko

1 answer 1

if you want every specific time interval to have a method called with updating geolocation, use NSTimer.

https://developer.apple.com/reference/foundation/timer