kanyun-inc / YTKNetwork

YTKNetwork is a high level request util based on AFNetworking.
MIT License
6.46k stars 1.66k forks source link

我想触发requestWillStart方法,requestAccessories、addAccessory如何使用? #526

Open suGaoFei opened 4 years ago

suGaoFei commented 4 years ago

提出问题前请先确认完成了下列几项步骤 New Issue Checklist

问题描述 Issue Description

请给出所提出问题的详尽描述,包括具体的错误信息,打印的堆栈等等,以及重现此问题的具体步骤。

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

suGaoFei commented 4 years ago

我想使用:

    • (void)requestWillStart:(id)request;
    • (void)requestWillStop:(id)request; 两个方法,子类继承YTKRequest后,重写了这两个方法,但是调用接口: startWithCompletionBlockWithSuccess方式并不会走进上述方法。 我断点发现需要:
    • (void)toggleAccessoriesWillStartCallBack { for (id accessory in self.requestAccessories) { if ([accessory respondsToSelector:@selector(requestWillStart:)]) { [accessory requestWillStart:self]; } } } 所以,如何使用 @property (nonatomic, strong, nullable) NSMutableArray<id> *requestAccessories; 这个属性, 或者如何调用该方法:
    • (void)addAccessory:(id)accessory;
suGaoFei commented 4 years ago

[self addAccessory:self]; 解决问题了。 =。=