183
Pre iOS 5 you could do it in code:
I use this snippet just before the @implementation of the class where I need my fake heading and location data.
#if (TARGET_IPHONE_SIMULATOR)
@interface MyHeading : CLHeading
-(CLLocationDirection) magneticHeading;
-(CLLocationDirection) trueHeading;
@end
@implementation MyHeading
-(CLLocationDirection) magneticHeading { return 90; }
-(CLLocationDirection) trueHeading { return 91; }
@end
@implementation CLLocationManager (TemporaryLocationFix)
- (void)locationFix {
CLLocation *location = [[CLLocation alloc] initWithLatitude:55.932 longitude:12.321];
[[self delegate] locationManager:self didUpdateToLocation:location fromLocation:nil];
id heading = [[MyHeading alloc] init];
[[self delegate] locationManager:self didUpdateHeading: heading];
}
-(void)startUpdatingHeading {
[self performSelector:@selector(locationFix) withObject:nil afterDelay:0.1];
}
- (void)startUpdatingLocation {
[self performSelector:@selector(locationFix) withObject:nil afterDelay:0.1];
}
@end
#endif
After iOS 5 simply include a GPX file in your project like this to have the location updated continuously Hillerød.gpx:
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode">
<wpt lat="55.93619760" lon="12.29131930"></wpt>
<wpt lat="55.93625770" lon="12.29108330"></wpt>
<wpt lat="55.93631780" lon="12.29078290"></wpt>
<wpt lat="55.93642600" lon="12.29041810"></wpt>
<wpt lat="55.93653420" lon="12.28998890"></wpt>
<wpt lat="55.93660630" lon="12.28966710"></wpt>
<wpt lat="55.93670240" lon="12.28936670"></wpt>
<wpt lat="55.93677450" lon="12.28921650"></wpt>
<wpt lat="55.93709900" lon="12.28945250"></wpt>
<wpt lat="55.93747160" lon="12.28949540"></wpt>
<wpt lat="55.93770000" lon