Aspects don't intercept the methods of NSMutableString
ChrislosChen opened this issue · comments
NSMutableString *test1 = [[NSMutableString alloc] initWithString:@"abc"];
NSError *hookError = nil;
[NSMutableString aspect_hookSelector:@selector(appendString:) withOptions:AspectPositionInstead usingBlock:^(id aspectInfo, NSString *aString){
if (aString.length) {
NSLog(@"....%@", aString);
}
} error:&hookError];
if (hookError) {
NSLog(@"........%@", hookError);
}
[test1 appendString:@"123123"];
NSLog(@"......%@", test1);
The code above does't work , the log like this as below:
AOCTest[35714:10671370] ......abc123123
for why, can you help me have a look?
You can't hook a class cluster - there are multiple internal hidden classes representing this. It's a bad idea and Aspects is not made for that.
ok, great job, thank u