Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

Commit

Permalink
Adding docs for new notification
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejBalantic committed Apr 9, 2014
1 parent d61c71f commit 79813ff
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ To start tracking location on the device, call ``startLocationUpdates:distanceFi
```

#### 2. Subscribe to the notification events
From the viewcontroller where you intend to use a location of the device, subscribe to notification
From the viewcontroller where you intend to use a location of the device, subscribe to notification ``kMBLocationManagerNotificationLocationUpdatedName``
which is triggered whenever a new location is detected. When notification is posted, access
MBLocationManager's property ``currentLocation``

Notification ``kMBLocationManagerNotificationFailedName`` informs you about failed attempt to determine
the location (see [locationManager:didFailWithError](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#jumpTo_7) )


```objectivec
- (void)viewDidLoad
{
Expand All @@ -65,6 +69,17 @@ MBLocationManager's property ``currentLocation``
selector:@selector(changeLocation:)
name:kMBLocationManagerNotificationLocationUpdatedName
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(locationManagerFailed:)
name:kMBLocationManagerNotificationFailedName
object:nil];
}

-(void)locationManagerFailed:(NSNotification*)notification
{
NSLog(@"Location manager failed");
}

-(void)changeLocation:(NSNotification*)notification
Expand Down

0 comments on commit 79813ff

Please sign in to comment.