-
Notifications
You must be signed in to change notification settings - Fork 4
/
MyCLController.m
42 lines (34 loc) · 986 Bytes
/
MyCLController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// MyCLController.m
// GeoEvents
//
// Created by Martin Roedvand on 08/12/2009.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import "MyCLController.h"
@implementation MyCLController
@synthesize locationManager;
@synthesize delegate;
- (id) init {
self = [super init];
if (self != nil) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // send loc updates to myself
self.locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
}
return self;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[self.delegate locationUpdate:newLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
[self.delegate locationError:error];
}
- (void)dealloc {
[self.locationManager release];
[super dealloc];
}
@end