Can't hook class methods
Hello,
I have figured out an issue concerning class method (not instance methods).
I have tried to put this into my code :
[NSJSONSerialization aspect_hookSelector:@selector(JSONObjectWithData:options:error:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> info, NSData _data, NSJSONReadingOptions opt, NSError *_error){ NSLog(@"JSONObjectWithData:options:error: before | object:%@ | instance:%@ | class:%@",info,[info instance],[[info instance] class]); } error:NULL];
[NSJSONSerialization aspect_hookSelector:@selector(JSONObjectWithData:options:error:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info, NSData *data, NSJSONReadingOptions opt, NSError **error){
NSLog(@"JSONObjectWithData:options:error: after | object:%@ | instance:%@ | class:%@",info,[info instance],[[info instance] class]);
} error:NULL];
The Aspects did not intercept class methods examples set in my AppDelegate for example. Do you know a solution for this issue ?
Thanks
Hmm. Is there any info in the log why this might fail?
I have figured out that I have to use the 1.5 version for that. But it seems not working on arm64... Do you have any news when It could be released for arm64 devices / simulators ?
Never found the time to dig into that. PR's welcome :)
The version 1.4 works great on arm64 but does not contain Class Hook methods. The 1.5 doesnt work on arm64 but contains Class Hook Methods. Is there a way to add just the needed code from 1.5 to the 1.4 to just add on it the class hook methods functionnalities ? I think the problem is with trampoline on arm64
Again, I very much welcome pull requests. Currently 1.4 works for me as I use Apects for testing/mocking only - if this changes I'll put it more work.