Modify_positioning

修改定位 直接hook CLLocation

Posted by kunnan on August 21, 2018

# code

/**
 1. 修改定位; hook 原生API,直接替换为自己的即可
 */

#import <CaptainHook/CaptainHook.h>
#import "WechatPodForm.h"
#import <UIKit/UIKit.h>

CHDeclareClass(CLLocation);

CHOptimizedMethod0(self, CLLocationCoordinate2D, CLLocation, coordinate){
    CLLocationCoordinate2D coordinate = CHSuper(0, CLLocation, coordinate);
    if(pluginConfig.location.longitude || pluginConfig.location.latitude ){
        coordinate = pluginConfig.location;
    }
    return coordinate;
}

CHConstructor{
    CHLoadLateClass(CLLocation);
    CHClassHook(0, CLLocation, coordinate);
}

  • DingtalkPod

    • 功能介绍:修改钉钉位置打卡,调用 DingtalkPod 中 -(void)setLocation:(CLLocationCoordinate2D)location即可

    • code: 主要还是hook原生的

      CHConstructor{
          CHLoadLateClass(CLLocation);
          CHClassHook(0, CLLocation, coordinate);
      }
          
      

See Also

/Users/devzkn/bin//knpost Modify_positioning 修改定位 直接hook CLLocation -t tweak
#原来""的参数,需要自己加上""

转载请注明: > Modify_positioning