I have this code to wait a while to get high-precision data:
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
if((newLocation.horizontalAccuracy < 150 && newLocation.horizontalAccuracy > 0 && abs(howRecent) < 15.0 ))
}
The problem is in another part of my application, I need to wait until this method returns, so I used:
[NSThread sleepForTimeInterval:5];
Is this a good practice, or is there a better way to wait for another task to complete.
source
share