iPhone CLLocationManager updates every 0.5 seconds

后端 未结 2 1202
借酒劲吻你
借酒劲吻你 2020-12-12 02:26

For an app that does lots of calculation from the GPS, I need to get the latitude/longitude and speed every 0.5 second to be very accurate and avoid delay.

I am usin

相关标签:
2条回答
  • 2020-12-12 02:41
    [self.locationManager startUpdatingLocation];
    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self     selector:@selector(myTimerFunc) userInfo:nil repeats:YES];
    
    - (void)myTimerFunc
    {
        CLLocation location = self.locationManager.location;
        // do work here //
    }
    
     - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
    {
        // do nothing here //
    }
    
    0 讨论(0)
  • 2020-12-12 02:42

    You can't tell the location manager how often you want updates, but only respond when it chooses to give you updates. The timing of getting updates can't be counted on, it depends on the ease of finding WiFi signals and GPS signals.

    0 讨论(0)
提交回复
热议问题