Guest User

Untitled

a guest
Jan 16th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  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;
Add Comment
Please, Sign In to add comment