Latest 0.3.1
Homepage https://github.com/zhfeng20108/NBNetRequest
License MIT
Platforms ios 9.0, requires ARC
Dependencies AFNetworking
Frameworks CFNetwork
Authors

A network based on AFNetworking 3.0

Installation

target 'TargetName' do
pod 'NBNetRequest'
end

使用

    //配置
    [[NBNetworkConfig sharedInstance] setBaseUrl:@"http://www.weather.com.cn"];
    [[NBNetworkConfig sharedInstance] setResponseCodeKey:nil];
    [[NBNetworkConfig sharedInstance] setResponseDataKey:@"weatherinfo"];

    //ZFNetReuqestModel是NBBaseNetRequestModel的子类化,可自定义适合当前项目的信息
    ZFNetReuqestModel *requestModel = [ZFNetReuqestModel modelWithPath:@"/data/sk/101010100.html"];
    requestModel.requestMethod = NBNetRequestMethodGet;
    requestModel.useAccount = NO;
    requestModel.refreshCache = YES;
    //发送请求
    ZFNetRequest *request =
    [ZFNetRequest startWithRequestModel:requestModel completionBlockWithSuccess:^(NBBaseNetRequest *request) {
        NSLog(@"%@",[request responseJSONObject]);
        NSLog(@"%@",[request responseResultCode]);
        NSLog(@"%@",[request responseResultDictionary]);
    } failure:^(NBBaseNetRequest *request) {
    }];

终止网络请求

    [request stop];

Latest podspec

{
    "name": "NBNetRequest",
    "version": "0.3.1",
    "summary": "a net request based on AFNetworking.",
    "description": "net request.nn* Think: Why did you write this? What is the focus? What does it do?n* CocoaPods will be using this to generate tags, and improve search results.n* Try to keep it short, snappy and to the point.n* Finally, don't worry about the indent, CocoaPods strips it!",
    "homepage": "https://github.com/zhfeng20108/NBNetRequest",
    "license": "MIT",
    "authors": {
        "zhfeng": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/zhfeng20108/NBNetRequest.git",
        "tag": "0.3.1"
    },
    "source_files": "NBNetRequest/*.{h,m}",
    "frameworks": "CFNetwork",
    "requires_arc": true,
    "dependencies": {
        "AFNetworking": []
    }
}

Pin It on Pinterest

Share This