Open xygkevin opened 1 year ago
比如:
typedef void(^XXURLRequestCompletionBlock)(NSData *, NSURLResponse *, NSError *);
[NSURLSession st_hookInstanceMethod:@selector(dataTaskWithRequest:completionHandler:) option:STOptionBefore usingIdentifier:@"session_before" withBlock:^(id<StingerParams> params, NSMutableURLRequest *request, XXURLRequestCompletionBlock completionHandler){
}];
我想在NSURLSession的dataTaskWithRequest:completionHandler:方法执行之前修改参数,包括request以及completionHandler的实现,以便于在completionHandler调用的时候执行其他处理;
可以试下我这个PR的代码,https://github.com/eleme/Stinger/pull/25
可以试下我这个PR的代码,#25
完全匹配我的需求,经过一段时间的线上运行观察,一切OK
怎么样hook方法在方法执行之前修改参数