Just looking for the simplest example of extracting the gps coordinates - not looking to render them on a map or anything.
Thanks,
For iOS 8, do the following:
Add these lines to your Rakefile:
app.frameworks += ['CoreLocation']
app.info_plist['NSLocationWhenInUseUsageDescription'] = 'I need it'
app.info_plist['NSLocationAlwaysUsageDescription'] = 'I always need it'
In viewDidLoad
in your ViewController
add:
@locationManager = CLLocationManager.alloc.init
@locationManager.requestWhenInUseAuthorization
@locationManager.delegate = self
@locationManager.startUpdatingLocation
Implement locationManager:didUpdateLocations:
def locationManager(manager, didUpdateLocations:locations)
coordinate = locations[0].coordinate
puts "lat #{coordinate.latitude}, long #{coordinate.longitude}"
end
If you need just the current location once, then call:
manager.stopUpdatingLocation
after getting the location in didUpdateLocations
.