Latest 1.0.2
Homepage https://github.com/cbangchen/CBNetworking
License MIT
Platforms ios 7.0, requires ARC
Dependencies AFNetworking
Authors

![Gitter](https://badges.gitter.im/Join Chat.svg)MIT LicenceOpen Source Love

A second Encapsulation of AFNetworking!!

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C

Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'

pod 'CBNetworking', '~> 1.0.2'

Then, cd you directory and run the following command:

$ pod install

Architecture

CBNetworkStatus

  • CBNetworkStatusUnknown
  • CBNetworkStatusNotReachable
  • CBNetworkStatusNormal

CBRequestType

  • CBPOSTRequest
  • CBGETRequest

CBSerializerType

  • CBHTTPSerializer
  • CBJSONSerializer

Basic Usage

Creating a Request Task

+ (CBURLSessionTask *)requestWithUrl:(NSString *)url
                              params:(NSDictionary *)params
                         httpMedthod:(CBRequestType)httpMethod
                       progressBlock:(CBDownloadProgress)progressBlock
                        successBlock:(CBResponseSuccessBlock)successBlock
                           failBlock:(CBResponseFailBlock)failBlock;

Creating an Image Upload Task

+ (CBURLSessionTask *)uploadWithImage:(UIImage *)image
                                  url:(NSString *)url
                                name:(NSString *)name
                                type:(NSString *)type
                              params:(NSDictionary *)params
                       progressBlock:(CBUploadProgressBlock)progressBlock
                        successBlock:(CBResponseSuccessBlock)successBlock
                           failBlock:(CBResponseFailBlock)failBlock;

Creating an File Upload Task

+ (CBURLSessionTask *)uploadFileWithUrl:(NSString *)url
                          uploadingFile:(NSString *)uploadingFile
                          progressBlock:(CBUploadProgressBlock)progressBlock
                           successBlock:(CBResponseSuccessBlock)successBlock
                              failBlock:(CBResponseFailBlock)failBlock;

Creating an File Download Task

+ (CBURLSessionTask *)downloadWithUrl:(NSString *)url
                           saveToPath:(NSString *)saveToPath
                        progressBlock:(CBDownloadProgress)progressBlock
                         successBlock:(CBResponseSuccessBlock)successBlock
                            failBlock:(CBResponseFailBlock)failBlock;

Task Manager

Cancel All Request

+ (void)cancelAllRequest;

Cancel Request With Url

+ (void)cancelRequestWithURL:(NSString *)url;

Cache Manager

Get Total Cache Size

+ (unsigned long long)totalCacheSize;

Clear Cache

+ (void)clearCaches;

License

CBNetworking is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "CBNetworking",
    "version": "1.0.2",
    "summary": "u5bf9u4e8eAFNetWorkingu7684u5c01u88c5.",
    "homepage": "https://github.com/cbangchen/CBNetworking",
    "license": "MIT",
    "authors": {
        "u9648u8d85u90a6": "http://cbang.info"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/cbangchen/CBNetworking.git",
        "tag": "1.0.2"
    },
    "source_files": "CBNetworking/CBNetworking/*.{h,m}",
    "dependencies": {
        "AFNetworking": [
            "~> 3.0"
        ]
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This