For location finding Google AutoComplete works good but its returning the search results all over the world. I want to restrict the search results either with in the 1000 meter radius or in a city. I followed this google link to integrate the autocomplete search. Only this below code used in project
-(void)autoComplete
{
GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.delegate = self;
[self presentViewController:acController animated:YES completion:nil];
}
// Handle the user's selection.
- (void)viewController:(GMSAutocompleteViewController *)viewController
didAutocompleteWithPlace:(GMSPlace *)place {
[self dismissViewControllerAnimated:YES completion:nil];
// Do something with the selected place.
NSLog(#"Place name %#", place.name);
NSLog(#"Place address %#", place.formattedAddress);
NSLog(#"Place attributions %#", place.attributions.string);
}
- (void)viewController:(GMSAutocompleteViewController *)viewController
didAutocompleteWithError:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:nil];
// TODO: handle the error.
NSLog(#"Error: %#", [error description]);
}
// User canceled the operation.
- (void)wasCancelled:(GMSAutocompleteViewController *)viewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
You cannot 100% restrict it, But you can give more priority to your city by specifying its northeast and southwest corners, Here is the code
GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.delegate = self;
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(northEastLati, northEastLongi);
CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(southWestLati, southWestLongi);
acController.autocompleteBounds = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast
coordinate:southWest];
[self presentViewController:acController animated:YES completion:nil];
Now you will get 99% of result will be belongs to your city. Hope it will help you.
Adding Swift Version.
If your autocompleteController is being presented, refresh it by calling
updateCoordinateBoundsOnAutoCompleteController()
/* Returns Bounds */
func getCoordinateBounds(latitude:CLLocationDegrees ,
longitude:CLLocationDegrees,
distance:Double = 0.001)->GMSCoordinateBounds{
let center = CLLocationCoordinate2D(latitude: latitude,
longitude: longitude)
let northEast = CLLocationCoordinate2D(latitude: center.latitude + distance, longitude: center.longitude + distance)
let southWest = CLLocationCoordinate2D(latitude: center.latitude - distance, longitude: center.longitude - distance)
return GMSCoordinateBounds(coordinate: northEast,
coordinate: southWest)
}
/* Refreshes AutoCompleteController */
func updateCoordinateBoundsOnAutoCompleteController(){
autocompleteController.viewWillAppear(true)
autocompleteController.viewDidAppear(true)
}
Related
I want to track the location of my ios device and notify in the app if it crosses certain kilometres.Suppose I want to notify if it crosses 1 km from current location of device. Please help I am new in iOS programming.
I am able to fetch the current location.
Please help.
Here what I am able to do.
- (void)viewDidLoad
{
[super viewDidLoad];
self.mapView.delegate=self;
// Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy=kCLLocationAccuracyBest;
self.locationManager.distanceFilter = kCLLocationAccuracyBestForNavigation;//constant update of device location
[self.locationManager requestWhenInUseAuthorization];
[self.locationManager requestAlwaysAuthorization];
[self.locationManager startUpdatingLocation];
}
-(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
self.userLocation = userLocation;
MKCoordinateSpan coordinateSpan; coordinateSpan.latitudeDelta = 0.3f; coordinateSpan.longitudeDelta = 0.3f;
MKCoordinateRegion regionToShow; regionToShow.center = userLocation.coordinate; regionToShow.span = coordinateSpan;
[self.mapView setRegion:regionToShow animated:YES];
MKPointAnnotation *point=[[MKPointAnnotation alloc]init];
point.coordinate=userLocation.coordinate;
point.title=#"where Am I";
point.subtitle=#"YOU are Here";
[self.mapView addAnnotation:point];
}
self.currentLocation must be an object of CLLocation.
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
CLLocationDistance dist = [self.currentLocation distanceFromLocation:userLocation.location];
if (dist == 1000.0) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:#"Title" message:[NSString stringWithFormat:#"Message : you moved %.2f", dist] preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:#"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// your code on OK click
}]];
[self presentViewController:alert animated:TRUE completion:^{ }];
}
self.currentLocation = userLocation.location;
self.userLocation = userLocation;
}
I am trying to rotate my MapView using CoreMotion around userLocation point. I'm successful in rotating the view but there is one problem: When the mapView is rotated the background white started showing. As shown in this picture (Ignore the red box below):The code I'm using to accomplish this is:
- (void)viewDidLoad {
locationManager = [[CLLocationManager alloc] init];
_mapView.delegate = self;
locationManager.delegate = self;
[locationManager requestWhenInUseAuthorization];
[locationManager startUpdatingLocation];
_mapView.showsUserLocation = YES;
[_mapView setMapType:MKMapTypeStandard];
[_mapView setZoomEnabled:YES];
[_mapView setScrollEnabled:YES];
locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.headingFilter = 1;
[locationManager startUpdatingHeading];
motionManager = [[CMMotionManager alloc] init];
motionManager.accelerometerUpdateInterval = 0.01;
motionManager.gyroUpdateInterval = 0.01;
[motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue currentQueue]
withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
if (!error) {
[self outputAccelertionData:accelerometerData.acceleration];
}
else{
NSLog(#"%#", error);
}
}];
}
and for the heading
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
//self.lblGrados.text = [NSString stringWithFormat:#"%.0f°", newHeading.magneticHeading];
// Convert Degree to Radian and move the needle
float newRad = -newHeading.trueHeading * M_PI / 180.0f;
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.mapView.transform = CGAffineTransformMakeRotation(newRad);
} completion:nil];
}
This method calls the one below:
- (void)outputAccelertionData:(CMAcceleration)acceleration{
//UIInterfaceOrientation orientationNew;
// Get the current device angle
float xx = -acceleration.x;
float yy = acceleration.y;
float angle = atan2(yy, xx);
}
anf finally:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800.0f, 200.0f);
//[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
[self.mapView setCenterCoordinate:userLocation.location.coordinate animated:YES];
[self.mapView setRegion:region animated:YES];
}
- (NSString *)deviceLocation {
return [NSString stringWithFormat:#"latitude: %f longitude: %f", locationManager.location.coordinate.latitude, locationManager.location.coordinate.longitude];
}
- (NSString *)deviceLat {
return [NSString stringWithFormat:#"%f", locationManager.location.coordinate.latitude];
}
- (NSString *)deviceLon {
return [NSString stringWithFormat:#"%f", locationManager.location.coordinate.longitude];
}
- (NSString *)deviceAlt {
return [NSString stringWithFormat:#"%f", locationManager.location.altitude];
}
So, what am I missing here? As far as I gone it has something to do with self.mapView.transform = CGAffineTransformMakeRotation(newRad); but I don't know what to change it to.
Try following code
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:true];
It works
I am working on goole map and i add the following for search bar on google map and get the coordinates of particular search address. Now i want to show it on map also after selection on place. Please look at my code.
-(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.delegate = self;
[self presentViewController:acController animated:YES completion:nil];
}
- (void)viewController:(GMSAutocompleteViewController *)viewController
didAutocompleteWithPlace:(GMSPlace *)place {
// Do something with the selected place.
NSLog(#"Place name %#", place.name);
NSLog(#"Place address %#", place.formattedAddress);
NSLog(#"Place attributions %#", place.attributions.string);
NSLog(#"lat and log%f", place.coordinate.latitude);
NSLog(#"lang %f", place.coordinate.longitude);
CLLocationCoordinate2D *coordinates = CLLocationCoordinate2DMake(place.coordinate.latitude, place.coordinate.longitude);
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate setTarget:coordinates zoom:10];
[_mapView animateWithCameraUpdate:updatedCamera];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewController:(GMSAutocompleteViewController *)viewController
didFailAutocompleteWithError:(NSError *)error {
// TODO: handle the error.
NSLog(#"error: %ld", (long)[error code]);
[self dismissViewControllerAnimated:YES completion:nil];
}
// User canceled the operation.
- (void)wasCancelled:(GMSAutocompleteViewController *)viewController {
NSLog(#"Autocomplete was cancelled.");
[self dismissViewControllerAnimated:YES completion:nil];
}
How will i update lat and long on map?
CLLocationCoordinate2D *coordinates = CLLocationCoordinate2DMake(place.coordinate.latitude,place.coordinate.longitude);
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate setTarget:coordinates zoom:10];
[yourmapViewName animateWithCameraUpdate:cameraUpdate];
Update Answer
- (void)viewController:(GMSAutocompleteViewController *)viewController
didAutocompleteWithPlace:(GMSPlace *)place {
// Do something with the selected place.
NSLog(#"Place name %#", place.name);
NSLog(#"Place address %#", place.formattedAddress);
NSLog(#"Place attributions %#", place.attributions.string);
NSLog(#"lat and log%f", place.coordinate.latitude);
NSLog(#"lang %f", place.coordinate.longitude);
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(place.coordinate.latitude,place.coordinate.longitude);
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate setTarget:coordinates zoom:10];
[yourmapViewName animateWithCameraUpdate:cameraUpdate];
[self dismissViewControllerAnimated:YES completion:nil];
}
I am new to IOS i need to show default location with my latitude and longitude(12.940358, 80.208647).
with annotation pin.
.h file:
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
#interface Map_view : UIViewController<MKMapViewDelegate,CLLocationManagerDelegate>{
CLLocationManager *locationmgr;
CLGeocoder *geocode;
CLPlacemark *placemark;
}
#property(nonatomic,retain)IBOutlet MKMapView *map11;
.m file:
#synthesize map11;
I don't no where to put my latitude and longitude and how to use please help me.
If you want to show your location with your lat & long with Annotation With Name.
Use this code.
- (void)viewDidLoad {
[super viewDidLoad];
mapVW.showsUserLocation = YES;
CLLocation *loc = [[CLLocation alloc]initWithLatitude:12.940358 longitude:80.208647];
[mapVW setCenterCoordinate:loc.coordinate animated:YES];
CLGeocoder *ceo = [[CLGeocoder alloc]init];
[ceo reverseGeocodeLocation:loc
completionHandler:^(NSArray *placemarks, NSError *error) {
CLPlacemark *placemark = [placemarks objectAtIndex:0];
//String to hold address
NSString *locatedAt = [[placemark.addressDictionary valueForKey:#"FormattedAddressLines"] componentsJoinedByString:#", "];
NSString *cityName = placemark.locality;
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = CLLocationCoordinate2DMake(12.940358, 80.208647);
annotationPoint.title = locatedAt;
MKCoordinateRegion region;
MKCoordinateSpan span1;
span1.latitudeDelta = 0.08;
span1.longitudeDelta = 0.08;
region.span = span1;
region.center = annotationPoint.coordinate;
[mapVW setRegion:region animated:TRUE];
[mapVW regionThatFits:region];
[mapVW addAnnotation:annotationPoint];
[mapVW selectAnnotation:annotationPoint animated:NO];
}
];
}
For centering on user location, you can use the following code:
[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
For zooming on special locations, you should study how the regions (MKCoordinateRegion) are counted and work, count your latitude and longitude values for the region and display it using call:
[mapView setRegion:myRegion animated:YES];
Try the following code :
CLLocationCoordinate2D zoomLocation;
zoomLocation.latitude = 39.281516;
zoomLocation.longitude= -76.580806;
// 2
MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE);
// 3
[_mapView setRegion:viewRegion animated:YES];
This code will set your region in your map.. Then follow the steps to add annotation in your map..
// Add an annotation
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = userLocation.coordinate; // Change coordinate as yours
point.title = #"Where am I?";
point.subtitle = #"I'm here!!!";
[self.mapView addAnnotation:point];
Hope it helps..
use this code it will help you:
- (void)location
{
_locationManger =[[CLLocationManager alloc]init];
_locationManger.distanceFilter=kCLDistanceFilterNone;
_locationManger.desiredAccuracy=kCLLocationAccuracyHundredMeters;
[_locationManger startUpdatingLocation];
[map11 setMapType:MKMapTypeStandard];
[map11 setZoomEnabled:YES];
[map11 setScrollEnabled:YES];
MKCoordinateRegion region={ {0.0,0.0 },{0.0,0.0}};
region.center.latitude = 12.940358 ;
region.center.longitude = 80.208647;
region.span.longitudeDelta = 20.20f;
region.span.latitudeDelta = 20.20f;
[map11 setRegion:region animated:YES];
[map11 setDelegate:sender];
}
It will show your desired location as
add this code in your viewdidload
//self.locationManager replace it with your locationmgr
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
#ifdef __IPHONE_8_0
if(IS_OS_8_OR_LATER) {
// Use one or the other, not both. Depending on what you put in info.plist
[self.locationManager requestWhenInUseAuthorization];
[self.locationManager requestAlwaysAuthorization];
}
#endif
[self.locationManager startUpdatingLocation];
mapView.showsUserLocation = YES;
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
in viewdidappear add below code
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:YES];
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
NSLog(#"%#", [self deviceLocation]);
CLLocationCoordinate2D userLocation = CLLocationCoordinate2DMake( self.locationManager.location.coordinate.latitude, self.locationManager.location.coordinate.longitude);
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
[annotation setCoordinate:userLocation];
[annotation setTitle:#"Your Location"];
[self.mapView addAnnotation:annotation];
//always show the name of annotation
[self.mapView selectAnnotation:annotation animated:YES];
//location 1
CLLocationCoordinate2D loc1Coord = CLLocationCoordinate2DMake(18.998250, 72.848734);//add your latitude and longitude here
MKPointAnnotation *annotation1 = [[MKPointAnnotation alloc] init];
[annotation1 setCoordinate:loc1Coord];
[annotation1 setTitle:#"title"];
[annotation1 setSubtitle:#"subtitle"];
[self.mapView addAnnotation:annotation1];
}
add this methods
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:#"loc"];
annotationView.canShowCallout = YES;
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
return annotationView;
}
Thats it, you can see your latitude and longitude in the map.Let me know if it is working or not?
first You have to set DELEGATE
and Import following in your .h file
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
after that make a property
#property(retain, nonatomic) CLLocationManager *locationManager;
and in ViewDidLoad
mapview.delegate = self;
and then You can do like belew
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
// Add an annotation
MKPointAnnotation *point = [[MKPointAnnotation alloc] init];
point.coordinate = userLocation.coordinate;
point.title = #"Where am I?";
point.subtitle = #"I'm here!!!";
[self.mapView addAnnotation:point];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - to get User Current Location.
- (void)getUserLocation{
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
#ifdef __IPHONE_8_0
if([self getDeviceOSVersion].integerValue >= 8) {
// Use one or the other, not both. Depending on what you put in info.plist
[self.locationManager requestWhenInUseAuthorization];
[self.locationManager requestAlwaysAuthorization];
}
#endif
[self.locationManager startUpdatingLocation];
}
-(NSString *)getDeviceOSVersion{
return [NSString stringWithFormat:#"%#",[UIDevice currentDevice].systemVersion];
}
#pragma mark - CLLocationManagerDelegate
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
UIAlertController *errorAlert = [UIAlertController alertControllerWithTitle:#"ERROR" message:#"There was an error retrieving your location"preferredStyle:UIAlertControllerStyleAlert ];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:#"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[errorAlert dismissViewControllerAnimated:YES completion:nil];
}];
[errorAlert addAction:ok];
[self presentViewController:errorAlert animated:YES completion:nil];
NSLog(#"Error: %#",error.description);
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLocation *currentLocation = [locations lastObject];
//currentLocation.coordinate.longitude = currentLocation.coordinate.longitude ;
// latitude = currentLocation.coordinate.latitude;
[self.locationManager stopUpdatingLocation];
}
I am implementing the route directions from my current location to some destination location.
When I enter in a specific page, my application crashes. But if I run the app again, it shows the route directions.
I found out the problem is that the first time, current location is showing as 0.00000,0.00000 coordinates. The second time I launch the app, current location is showing up correctly.
What is going wrong?
I want to get my current position correctly at first time.
I am writing the code on below. Once please check it out and let me know the where is the problem in my code
#import "MapWithRoutesViewController.h"
#import "TFSViewController.h"
#implementation MapWithRoutesViewController
#synthesize locationManager,lat,lon;
- (void) updateCurrentLabel {
NSObject *latitude = [NSString stringWithFormat:#"%f", locationManager.location.coordinate.latitude];
NSObject *longitude = [NSString stringWithFormat:#"%f", locationManager.location.coordinate.longitude];
locationlable.text = [NSString stringWithFormat: #"Current Location: %#,%#", latitude, longitude];
}
- (void)viewDidLoad {
[self getCurrentLocation];
[super viewDidLoad];
}
-(void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
[self updateCurrentLabel];
}
-(void) getCurrentLocation {
MapView* mapView = [[[MapView alloc] initWithFrame:
CGRectMake(0, 90, self.view.frame.size.width, self.view.frame.size.height)] autorelease]; [self.view
addSubview:mapView];
Place* home = [[[Place alloc] init] autorelease];
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
if (locationManager==NO) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Location Service Disabled"
message:#"To re-enable, please go to Settings and turn on Location Service for
this app."
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
} else {
// if (locationManager==NO)
// [mapView.lo addObserver:self forKeyPath:#"location"
// options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
// context:nil];
}
locationManager.pausesLocationUpdatesAutomatically = NO;
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
[locationManager setPausesLocationUpdatesAutomatically:YES];
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
CLLocation *Loc = [locationManager location];
CLLocationCoordinate2D coordinate = [Loc coordinate];
NSObject *latitude = [NSString stringWithFormat:#"%f", locationManager.location.coordinate.latitude];
NSObject *longitude = [NSString stringWithFormat:#"%f", locationManager.location.coordinate.longitude];
NSLog(#"lat,lon %#%#",latitude,longitude);
home.name = #"";
home.description = #"";
home.latitude = coordinate.latitude;
home.longitude = coordinate.longitude;
Place* office = [[[Place alloc] init] autorelease];
office.name = #"";
office.description = #"";
office.latitude = 22.0000;
office.longitude = 88.0008;
[mapView showRouteFrom:home to:office];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(IBAction)back:(id)sender{
[self dismissViewControllerAnimated:YES completion:nil];
}
-(IBAction)tfs:(id)sender{
TFSViewController *tfs = [[TFSViewController alloc]initWithNibName:#"TFSViewController" bundle:nil];
[self presentViewController:tfs animated:YES completion:nil];
}
#end
The trouble is you're making the location manager and then expecting it to have a location a few micro seconds later. You should be setting the location manager's delegate and then waiting for it to be called. When LM has a location it will call didUpdateLocation and you can use that to call updateCurrentLabel
You should use delegate method -locationManager:didUpdateLocations: to get the locations. CLLocationManager takes few seconds to establish a GPS connection and determine the current location.
http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didUpdateLocations:
You could also use CLLocation's horizontalAccuracy property to check the accuracy of the location to determine if you want to use the value or discard it.
http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/occ/cl/CLLocation