lucianboboc / LBLocation

LBLocation class will help you get the user location very easy and make forward and reverse geocoding.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LBLocation

LBLocation class will help you get the user location very easy and make forward and reverse geocoding.

How to use LBLocation class into your project

Import CoreLocation, MapKit and AddressBookUI frameworks.

Create the LBLocation object using initWithLocationUpdateBlock:.

The completionBlock will be called with the CLLocation value or, in case of error the completionBlock is called with a nil value.

The LBLocation class uses NSNotificationCenter and calls the startLocationServices method when the UIApplicationDidBecomeActiveNotification notification is received. It also calls the stopLocationServices when the UIApplicationWillResignActiveNotification notification is received.

EXAMPLE

     __weak ViewController *weakSelf = self;
    self.location = [[LBLocation alloc] initWithLocationUpdateBlock:^(CLLocation *location) {
        weakSelf.myLocation = location;
    }];

Reverse Geocoding

You can use reverseGeocodeCurrentLocationWithCompletionBlock: and reverseGeocodeLocation:completionBlock: methods and the completion block will be called with a CLPlacemark object or nil value.

You can get a string with the address from the CLPlacemark object using the addressStringFromPlacemark: method.

Forward Geocoding

You can use the geocodeAddressString:completionBlock: and geocodeAddressDictionary:completionBlock: methods,pass a string or dictionary with the address and the completion block will be called with a CLLocation object or nil value.

LICENSE

This content is released under the MIT License https://github.com/lucianboboc/LBLocation/blob/master/LICENSE.md

Enjoy!

About

LBLocation class will help you get the user location very easy and make forward and reverse geocoding.

License:Other


Languages

Language:Objective-C 100.0%