SHARE
TWEET

Untitled

a guest Jan 16th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void)getUserLocation{
  2.  
  3. self.geoCoder = [[CLGeocoder alloc] init];
  4. self.locationMng = [[CLLocationManager alloc]init];
  5. locationMng.delegate = self;
  6.  
  7. [self.geoCoder reverseGeocodeLocation: locationMng.location completionHandler:
  8.  ^(NSArray *placemarks, NSError *error) {
  9.  
  10.  
  11.      CLPlacemark *placemark = [placemarks objectAtIndex:0];
  12.  
  13.  
  14.      NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
  15.  
  16.  
  17.      NSLog(@"I am currently at %@",locatedAt);
  18.  
  19.  
  20.     [locationLabel setText:locatedAt];
  21.  
  22.  }];
  23.  
  24. }
  25.    
  26. @property (retain, nonatomic) CLLocationManager *locationMng;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top