Skip to content
Browse files

fake location

  • Loading branch information...
1 parent dffe451 commit c13f1e409c726d9482cac189dee2fee1ad94bb5a @drewcrawford committed Mar 13, 2013
Showing with 21 additions and 1 deletion.
  1. +21 −1 BriefcaseWars2/BW2NavigateViewController.m
View
22 BriefcaseWars2/BW2NavigateViewController.m
@@ -9,6 +9,14 @@
#import "BW2NavigateViewController.h"
#import <CoreMotion/CoreMotion.h>
#import <CoreLocation/CoreLocation.h>
+
+@interface FakeHeading: NSObject{
+
+}
+@property(nonatomic) CLLocationDirection trueHeading;
+@end
+@implementation FakeHeading
+@end
@interface BW2NavigateViewController () {
CLLocationManager *myManager;
CLLocation *destination;
@@ -122,17 +130,29 @@ - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading
- (void)viewDidLoad
{
+#define FAKE_MODE 1
[super viewDidLoad];
- destination = [[CLLocation alloc] initWithLatitude:30.410433 longitude:-97.792767];
+ destination = [[CLLocation alloc] initWithLatitude:30.408806 longitude:-97.79291];
self.dstloc1.text = [NSString stringWithFormat:@"N %@",[self stringFromCoord:destination.coordinate.latitude]];
self.dstloc2.text = [NSString stringWithFormat:@"W %@",[self stringFromCoord:-1 * destination.coordinate.longitude]];
+#ifdef FAKE_MODE
+ FakeHeading *fakeHeading = [[FakeHeading alloc] init];
+ fakeHeading.trueHeading = 0.0;
+ [self locationManager:nil didUpdateHeading:fakeHeading];
+ CLLocation *fakeLocation = [[CLLocation alloc] initWithLatitude:
+ 30.409108 longitude:-97.792933];
+
+ [self locationManager:nil didUpdateLocations:@[fakeLocation]];
+
+#else
myManager = [[CLLocationManager alloc] init];
myManager.delegate = self;
myManager.desiredAccuracy = kCLLocationAccuracyBest;
[myManager startUpdatingHeading];
[myManager startUpdatingLocation];
+#endif
// Do any additional setup after loading the view from its nib.

0 comments on commit c13f1e4

Please sign in to comment.
Something went wrong with that request. Please try again.