Created
March 28, 2010 14:16
-
-
Save veritech/346779 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
// Created by Jonathan Dalrymple on 28/03/2010. | |
// Copyright 2010 Float:Right. All rights reserved. | |
// | |
#import "CLLocationManager-Mock.h" | |
@implementation CLLocationManager (Mock) | |
/* | |
* Start updating location | |
*/ | |
- (void) startUpdatingLocation{ | |
NSLog(@"[LocationMock startUpdating]"); | |
[self sendLocation]; | |
} | |
/* | |
* Stop updating location | |
*/ | |
- (void) stopUpdatingLocation{ | |
NSLog(@"[LocationMock stopUpdating]"); | |
} | |
/* | |
* | |
*/ | |
-(CLLocation*) location{ | |
NSLog(@"Getting location"); | |
return nil; | |
} | |
/* | |
*/ | |
-(void) sendLocation{ | |
CLLocation *newLocation; | |
newLocation = [[CLLocation alloc] initWithLatitude: 0.0f | |
longitude: 0.0f | |
]; | |
//Test for a delegate | |
if( [self delegate] ){ | |
if( [[self delegate] respondsToSelector:@selector(locationManager:didUpdateToLocation:fromLocation:)] ){ | |
//Call the delegate method | |
[[self delegate] locationManager: self | |
didUpdateToLocation: newLocation | |
fromLocation: newLocation | |
]; | |
} | |
else if( [[self delegate] respondsToSelector: @selector(locationManager:didUpdateToLocation:fromLocation:usingSupportInfo:)]){ | |
NSLog(@"Call worked"); | |
[[self delegate] locationManager: self didUpdateToLocation: newLocation fromLocation: newLocation usingSupportInfo: nil]; | |
} | |
else{ | |
NSLog(@"%@ Doesn't respond to the selector", [self delegate]); | |
} | |
} | |
else{ | |
NSLog(@"No Delegate"); | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment