?? 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