Created
March 21, 2010 21:46
-
-
Save veritech/339594 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
// | |
// CLLocation-Extras.m | |
// | |
// Created by Jonathan Dalrymple on 21/03/2010. | |
// Copyright 2010 Float:Right. All rights reserved. | |
// | |
#import "CLLocation-Extras.h" | |
@implementation CLLocationManager(Extras) | |
/* | |
Convience method | |
*/ | |
+(CLLocationManager*) sharedInstance{ | |
id appDelegate; | |
appDelegate = [[UIApplication sharedApplication] delegate]; | |
//Does the delegate respond? | |
if( [appDelegate respondsToSelector:@selector( locationManager)] ){ | |
NSLog(@"[CLLocationManager] create instance"); | |
//Create a delegate if required | |
if( [appDelegate locationManager] == nil ){ | |
[appDelegate setLocationManager:[[CLLocationManager alloc] init]]; | |
} | |
//Return an instance | |
return [appDelegate locationManager]; | |
} | |
else{ | |
NSLog(@"[CLLocationManager] Property not found on AppDelegate"); | |
return nil; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment