Open the log
- in
log_and_fill_cache
In the delta function, we saw thatobjcMsgLogEnabled
This variable, of course, isobjcMsgLogEnabled = true
, the system can printmsgSend
The log - We find where it’s assigned
- Obviously we call
instrumentObjectMessageSends
Method can be assigned to it
- Location where logs are stored
/tmp/msgSends-%d
use
- Currently only in
mac
The simulator hasn’t found a solution yet - The statement
extern void instrumentObjcMessageSends(BOOL flag);
extern void instrumentObjcMessageSends(BOOL flag);
int main(int argc, const char * argv[]) {
@autoreleasepool {
instrumentObjcMessageSends(YES);
WLWPerson *person = [WLWPerson alloc];
[WLWPerson say666];
instrumentObjcMessageSends(NO);
NSLog(@"Hello, World!");
}
return 0;
}
Copy the code
- And then in the system
tmp
directory
- You can view the corresponding log
- You can see the whole
objc_msgSend
process - resolveClassMethod -> resolveInstanceMethod -> forwardingTargetForSelector->methodSignatureForSelector -> resolveInstanceMethod -> doesNotRecognizeSelector