1、hook SpringBorad
我们还需要写两个头文件骗过编译器,并在tweak.xm中导入。
// CLLocationManager.h
@interface CLLocationManager
+(id)sharedManager;
+(BOOL)locationServicesEnabled;
+(void)setLocationServicesEnabled:
(BOOL)enabled;
@end
判断是否打开定位
[[CLLocationManager sharedManager]locationServicesEnabled]
打开定位
[CLLocationManager setLocationServicesEnabled: YES]
关闭定位
[CLLocationManager setLocationServicesEnabled: NO]