Before 1, we always used the proxy method when we used the data requested by the server




The value is then passed in the request body




Then declare proxies where data is needed and add proxy methods




Then, the data from the server will be operated in the data request, taking wechat Payment as an example




Don’t forget the protocol, of course




In this way, the proxy value method is used, so that the data is requested from the server, and then transmitted to the controller that needs to be used, and the value operation is carried out in the proxy method. The middle episode is that when we make a network request, sometimes the network or server will take a long time to request the state. At this point we can add a condition on the request time




After 30 seconds, the request timeout message will be automatically returned. (The default time is 60 seconds. If the request fails to receive data, a message is displayed indicating that the request has timed out.)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Big drew

2. In fact, we found that using proxy value method to value the server is a bit slow, it will be a bit troublesome. It’s actually easier to use a Block callback




typedef void(^Success)(id responseObject); typedef void(^Failure)(NSError *error); Use these two sentences to call back data after a successful or failed request. And then make the request




This method alone implements requests and calls for data. Call directly with the class object. It saves a lot of red tape. Of course it is safer to use singletons to create network request class objects when we use this








This is actually more comfortable to call.

                                                                                                       ——-SAW