Latest 0.0.3
Homepage https://github.com/wochen85/JsonModelHttp
License MIT
Platforms ios 8.0, requires ARC
Dependencies MJExtension, AFNetworking
Authors

整合简化Http+Json的网络调用

Requirements

  • iOS 8.0+
  • ARC

Installation

CocoaPods

Add the following to your podfile

pod 'JsonModelHttp'

manual

Add JsonModelHttp folder to your prject

Usage

Example

First, create your Model(ReqModel,GetResModel,ResModel).

You can create your Model using https://github.com/netyouli/WHC_DataModelFactory.

GET

[JsonModelHttp fire:@"GET" url:@"http://www.httpbin.org/get" param:@{@"param":@"hello"} headers:@{@"Myheader":@"world"} body:nil responseModelClass:[GetResModel class] success:^(GetResModel* model) {

                                } failure:^(NSError *error) {

                                }];

POST

[JsonModelHttp fire:@"POST" url:@"http://www.httpbin.org/post" param:nil headers:@{@"Myheader":@"world"} body:reqModel responseModelClass:[ResModel class] success:^(ResModel* model) {

                                } failure:^(NSError *error) {

                                }];

DELETE

[JsonModelHttp fire:@"DELETE" url:@"http://www.httpbin.org/delete" param:@{@"param":@"hello"} headers:@{@"Myheader":@"world"} body:reqModel responseModelClass:[ResModel class] success:^(ResModel* model) {

                                } failure:^(NSError *error) {

                                }];

PUT

[JsonModelHttp fire:@"PUT" url:@"http://www.httpbin.org/put" param:@{@"param":@"hello"} headers:@{@"Myheader":@"world"} body:reqModel responseModelClass:[ResModel class] success:^(ResModel* model) {

                                } failure:^(NSError *error) {

                                }];

Latest podspec

{
    "name": "JsonModelHttp",
    "version": "0.0.3",
    "summary": "u6574u5408u7b80u5316Http+Jsonu7684u7f51u7edcu8c03u7528",
    "homepage": "https://github.com/wochen85/JsonModelHttp",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "CHAT": "[email protected]"
    },
    "source": {
        "git": "https://github.com/wochen85/JsonModelHttp.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "dependencies": {
        "MJExtension": [],
        "AFNetworking": []
    },
    "source_files": "JsonModelHttp/JsonModelHttp/*.{h,m}"
}

Pin It on Pinterest

Share This