Created
April 8, 2013 14:45
-
-
Save kwhinnery/5337321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WhereViewController.m | |
// WhereAmI | |
// | |
// Created by Kevin Whinnery on 4/8/13. | |
// Copyright (c) 2013 Kevin Whinnery. All rights reserved. | |
// | |
#import "WhereViewController.h" | |
@interface WhereViewController () | |
@end | |
@implementation WhereViewController | |
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
locationManager = [[CLLocationManager alloc] init]; | |
[locationManager setDelegate:self]; | |
[locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters]; | |
[locationManager setDistanceFilter:10]; | |
[locationManager startUpdatingLocation]; | |
} | |
return self; | |
} | |
-(void)locationManager:(CLLocationManager*)manager didUpdateLocations:(NSArray *)locations | |
{ | |
for (CLLocation *location in locations) { | |
NSLog(@"got location: %@", location); | |
} | |
[locationManager stopUpdatingLocation]; | |
} | |
-(void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError *)error | |
{ | |
NSLog(@"Could not find location %@", error); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment