blob: a32270413c48270ecbc3daeb66638a71e1ea9986 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//
// Based on gist by Eric Allam
// https://gist.github.com/ericallam/5689235
//
#import "LocationMocker.h"
#import "CSSwizzler.h"
#import "CLLocationManager+MockLocation.h"
@implementation LocationMocker
+ (void)load
{
[CSSwizzler swizzleClass:[CLLocationManager class]
replaceMethod:@selector(startUpdatingLocation)
withMethod:@selector(custom_startUpdatingLocation)];
[CSSwizzler swizzleClass:[CLLocationManager class]
replaceMethod:@selector(location)
withMethod:@selector(custom_location)];
[CSSwizzler swizzleClass:[CLLocationManager class]
replaceMethod:@selector(startUpdatingHeading)
withMethod:@selector(custom_startUpdatingHeading)];
[CSSwizzler swizzleClass:[CLLocationManager class]
replaceMethod:@selector(heading)
withMethod:@selector(custom_heading)];
[CSSwizzler swizzleClass:[CLLocationManager class]
replaceClassMethod:@selector(headingAvailable)
withMethod:@selector(custom_headingAvailable)];
}
@end
|