Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created April 8, 2013 14:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/5337321 to your computer and use it in GitHub Desktop.
Save kwhinnery/5337321 to your computer and use it in GitHub Desktop.
//
// 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