Network request essay

Source: Internet
Author: User

1, the network request should build a request model according to Http://www.cocoachina.com/ios/20160509/16146.html finishing

 @interface yaapibaserequestdatamodel:nsobject/*** Network request parameter */@property (              Nonatomic, Strong) NSString *ap  Imethodpath;            Network request Address @property (nonatomic, assign) Yaservicetype servicetype;             Server Identity @property (nonatomic, strong) Nsdictionary *parameters;  Request parameter @property (nonatomic, assign) Yaapimanagerrequesttype RequestType;      Network request Mode @property (nonatomic, copy) Completiondatablock Responseblock; Request Landing callback//upload//upload File@property (nonatomic, strong) NSString *datafilepath; @property (nonatomic, Strong) NSString *dataname; @property (nonatomic, strong) NSString *filename; @property (nonatomic, strong) NSString *mimetype;// download//Download file//progressblock@property (nonatomic, copy) Progressblock Uploadprogressblock; @property ( nonatomic, copy) Progressblock Downloadprogressblock; @end 

Benefits: 1, you can see that the Requestdatamodel property is the network request to initiate and return the necessary parameters, so the benefits are really too big, do not know that there is no such scenario: Because the request parameters are different to do a lot of methods interface exposed, the last tune up or the same method, And once the method is written more, and finally should call which method is not known.

2, another Requestdatamodel brings another advantage is the high scalability, you have not encountered the network layer need to add to delete a parameter resulting in the call method modification, and then many places to modify the method? With Requestdatamodel only need to add delete parameters on the line, only need to change the method body, the method body and the method name method is completely two work

Network request essay

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.