Latest 0.1.8
Homepage https://github.com/zLihuan/RicTaskHelper
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Usage

for downloaing

RicDownloadTask *downloadTask = [[RicDownloadTask alloc] init];

NSDictionary *taskInfo = @{@"downloadUrl":@"http://a4.att.hudong.com/38/47/19300001391844134804474917734_950.png"};

downloadTask.customInfomation = taskInfo;

downloadTask.progressHandle = ^(CGFloat progress){
NSLog(@"progress :%f",progress);
};

downloadTask.downloadAction = ^(RicTask* task,CompeletedNotice notice){
NSLog(@"doloading begin");

NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];

NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];

NSURL url = [NSURL URLWithString: task.customInfomation[@"downloadUrl"]];
NSURLSessionDownloadTask
dataTask = [defaultSession downloadTaskWithURL: url];

[dataTask resume];
};

RicTaskHelper *helper = [[RicTaskHelper alloc] init];
[helper addTask:downloadTask];

[helper startTasks:^{

} progressHandle:^(NSInteger compeletedCount, NSInteger totalCount) {
NSLog(@"%ld/%ld",compeletedCount,totalCount);

} compeleteAction:^{
NSLog(@"compeleted");
}];

for uploading

// prepare for the resouce or resouce information for uploading.
RicUploadTask *uploadTask = [[RicUploadTask alloc] init];

uploadTask.customInfomation = @{@"uploadData":@"some data here"};

uploadTask.uploadAction = ^(RicTask task,CompeletedNotice noticeBlock){
// get data from task.customInfomation

/// do you uploading operation here.

// when completed

noticeBlock();

};

RicTaskHelper *uploadHelper = [[RicTaskHelper alloc] init];

[uploadHelper addTask:uploadTask];

[uploadHelper startTasks:^{

// performing UI loading

} progressHandle:^(NSInteger compeletedCount, NSInteger totalCount) {

} compeleteAction:^{

}];

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

RicTaskHelper is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "RicTaskHelper"

Author

zLihuan, [email protected]

License

RicTaskHelper is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RicTaskHelper",
    "version": "0.1.8",
    "summary": "a TaskHelper for uploading or downloading operation using NSOperationQueue.",
    "description": "a TaskHelper for uploading or downloading operation of easy using NSOperationQueue.",
    "homepage": "https://github.com/zLihuan/RicTaskHelper",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "zLihuan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zLihuan/RicTaskHelper.git",
        "tag": "0.1.8"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "RicTaskHelper/Classes/**/*"
}

Pin It on Pinterest

Share This