iOS Development Mock interface Data (iii) the actual combat tutorial

Source: Internet
Author: User

?? After the last article, I have introduced some matching methods, this article mainly for everyone to talk about the actual operation of the steps.

How plist files are configured

?? The configuration of plist files is of great importance to Apimock, which is directly related to the application of AOP programming ideas to achieve jkapimock goals. Such as:

Here mainly for the get,post request to do processing, if an interface does not need to do data mock operation, Ismock set to No, in addition to the development process, the production server will switch the situation I only match the server behind the interface URL, does not match the server address. Of course, if you want to, you can add it yourself.

How to configure

?? The introduction of the project after the configuration is very small, do not need additional operations by pod "JKAPIMock" introducing into their own projects, the introduction of code when their own app: [JKMockManager registerWithJsonFile:@"RequestsData"];
//requestsdata is the name of the plist file, you can substitute the suffix name .plist , or without the suffix name.

Actual operation

?? I wrote a simple demo here that mainly demonstrates the mock operation of the Get,post interface.
The requested parameters are as follows:

_dataarray =  @[@{@ "url" : @ "/china/index.php?name=123&sex=male &age=22 ", @" method ": @" GET ", @ "Celltitle" : @ "GET Request" },@{@  "url" : @ "/china/abc.php" , @  "params" : @{@ "name" : @  "122" , @ "sex" : @ "DD" , @ "age" : @ "all" },@  "method" : @ "POST" , @ "Celltitle" : @ "POST request" }];    

The demo demo is as follows:

I have made the relevant code into the open source Library, interested friends, can view the demo address
can also be directly used in the introduction of the pod "JKAPIMock project, if there is any bad writing, also please criticize me oh.

iOS Development Mock interface Data (iii) the actual combat tutorial

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.