Latest1.0.2
Homepagehttps://github.com/EarthMass/GhxNetWorking
LicenseMIT
Platformsios 8.0, requires ARC
DependenciesAFNetworking
FrameworksFoundation, UIKit
Authors

基于AFNetworking网络框架的封装

适用版本 ios 8.0 +

pod

pod 'GhxNetWorking'

使用

网络判断

  • 网络判断

    [NetWorkHelper currentNetStatus:^(BOOL isConnect, AFNetworkReachabilityStatus currentStatus) {
    NSLog(@"");
    }];
  • 版本更新 通过 bundleid , so 不用修改什么配置
     [[NetWorkHelper sharedInstance] checkSystemIfNeedUpdate:^(BOOL isNeed, NSString *updateUrl, NSString *msg, NSDictionary *dic) {
        NSLog(@"");
    }];
    //block方法可以 再处理 比如,强制更新等
    [[NetWorkHelper sharedInstance] checkSystemIfNeedUpdate:nil];
  • 网络请求
  • 方法一 继承 Network 请求公共写在一个类

     NetWorkTool * netTool = [[NetWorkTool alloc] initWithSuccess:^(id obj) {
        NSLog(@"");
           } fail:^(id obj) {
        NSLog(@"");
    
      }];
    [netTool login:@"五华社区" pwd:@"123456" isclassify:YES];
  • 方法二 直接使用 降低耦合度

       NetWorkHelper * helper = [[NetWorkHelper alloc] init];
       NSMutableDictionary * params = [NSMutableDictionary dictionaryWithCapacity:1];
       [params setObject:@"五华社区" forKey:@"user"];
       [params setObject:[helper md5:@"123456"] forKey:@"password"];
       [params setObject:[NSString stringWithFormat:@"%d",1] forKey:@"isclassify"];
       [helper requestURLString:@"url" parameters:params httpRequestType:RequestPost succeed:^(id responseObject) {
    
          NSLog(@"");
    
       } failure:^(NSError *error) {
    
         NSLog(@"");
    
       }];

Latest podspec

{
    "name": "GhxNetWorking",
    "version": "1.0.2",
    "summary": "u57fau4e8eAFNetworkingu7f51u7edcu6846u67b6u7684u5c01u88c5",
    "description": "u57fau4e8eAFNetworkingu7f51u7edcu6846u67b6u7684u5c01u88c5nu5305u542buff1an  u7f51u7edcu8bf7u6c42n  u7248u672cu66f4u65b0n  u7f51u7edcu5224u65ad",
    "homepage": "https://github.com/EarthMass/GhxNetWorking",
    "license": "MIT",
    "authors": {
        "mars": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/EarthMass/GhxNetWorking.git",
        "tag": "1.0.2"
    },
    "source_files": "GhxNetWorking/NetWorkHelper/*.{h,m}",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true,
    "dependencies": {
        "AFNetworking": [
            "~>3.0"
        ]
    }
}

Pin It on Pinterest

Share This