method 1 ---- By logos
_01__WeChatDemo11Dylib.xm
%hook WCDeviceStepObject
- (unsigned int)m7StepCount{
return 23333;
}
%end
method 2 ---- By CaptainHoop
_01__WeChatDemo11Dylib.m
把DemoDylib.m文件中所有的内容删除(除导入头文件外).添加如下代码.
CHDeclareClass(WCDeviceStepObject); // declare class
CHOptimizedMethod(0, self, unsigned int, WCDeviceStepObject, m7StepCount) // hook method (with no arguments and no return value)
{
// write code here ...
return 98888; //随意改数
}
CHConstructor // code block that runs immediately upon load
{
@autoreleasepool
{
CHLoadLateClass(WCDeviceStepObject);
CHHook(0, WCDeviceStepObject,m7StepCount);
}
}