From 40d7eb40bdd3f1555a3121e7343a8cc6f0d7da1f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 25 Dec 2013 05:04:18 +0100 Subject: [PATCH] (Apple) Some minor cleanups to location manager code - still only reports a few initial locations and nothing afterwards --- apple/common/RAGameView.m | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/apple/common/RAGameView.m b/apple/common/RAGameView.m index 2d0f65ee9d..5ede776a0b 100644 --- a/apple/common/RAGameView.m +++ b/apple/common/RAGameView.m @@ -373,6 +373,19 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer RARCH_LOG("didUpdateLocations - latitude %f, longitude %f\n", (float)currentLatitude, (float)currentLongitude); } +- (void)onLocationInit +{ + // Create the location manager if this object does not + // already have one. + + if (locationManager == nil) + locationManager = [[CLLocationManager alloc] init]; + locationManager.delegate = self; + locationManager.desiredAccuracy = kCLLocationAccuracyBest; + locationManager.distanceFilter = kCLDistanceFilterNone; + [locationManager startUpdatingLocation]; +} + @end static RAScreen* get_chosen_screen() @@ -656,15 +669,8 @@ static void *apple_location_init() applelocation_t *applelocation = (applelocation_t*)calloc(1, sizeof(applelocation_t)); if (!applelocation) return NULL; - - // Create the location manager if this object does not - // already have one. - if (nil == locationManager) - locationManager = [[CLLocationManager alloc] init]; - - locationManager.delegate = [RAGameView get]; - locationManager.desiredAccuracy = kCLLocationAccuracyBest; - locationManager.distanceFilter = kCLDistanceFilterNone; + + [[RAGameView get] onLocationInit]; return applelocation; }