Latest 0.1.3
Homepage https://github.com/netcanis/IVSHTTP
License MIT
Platforms ios 9.0, requires ARC
Frameworks Foundation, UIKit, QuartzCore
Authors

CI Status
Version
License
Platform

Example

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

asyncSend

NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
@"VtT0curfvpEhkBfgCy3Xlmg9BEU7hmO5UYio3ECCUlm-T71BAjOaMVyDHgf7nmTpgXzvSsE4tRUCERUORDqbiwziHkTDd30Ym5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnJ9GRkcRevgjTvo8Dc32iw_BLJPcPfRdVKhJT5HNzQuXEeN3QFwl2n0M6ZmO-h7C6eIqWsDnSrEd", @"user_content_key",
@"MwxUjRcLr2qLlnVOLh12wSNkqcO1Ikdrk", @"lib", nil];

[IVSHTTP asyncSend:@"GET"
               url:@"https://script.googleusercontent.com/macros/echo"
        parameters:parameters
           success:^(NSData *data) {
               NSLog(@"n--------------------------------nasyncSendn%@n", [IVSHTTP data2Json:data]);

               NSMutableDictionary *dic = [IVSHTTP data2Cont:data];
               NSString *dayofweekName = [dic objectForKey:@"dayofweekName"];
           }
           failure:^(NSError *error) {
                NSLog(@"%@", error.description);
           }];

syncSend

NSData *data = [IVSHTTP syncSend:@"GET"
                             url:@"https://app.dcgworld.com/api/version"
                      parameters:parameters];

asyncDownload

[IVSHTTP asyncDownload:@"https://www.gstatic.com/webp/gallery3/1.sm.png"
               success:^(NSData *data, NSDictionary* info) {
                   NSString *fileName = [info objectForKey:@"fileName"];
                   NSString *filePath = [info objectForKey:@"filePath"];
                   NSLog(@"nasyncDownloadnfileName:n%@nfilePath:n%@n", fileName, filePath);
                   NSLog(@"");
               }
               failure:^(NSError *error) {
                   NSLog(@"%@", error.description);
               }];

syncDownload

NSDictionary *info = nil;
NSData *data = [IVSHTTP syncDownload:@"https://www.gstatic.com/webp/gallery3/1.sm.png" info:&info];
NSString *fileName = [info objectForKey:@"fileName"];
NSString *filePath = [info objectForKey:@"filePath"];

asyncUpload

NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"IVSHTTP", @"appId",
                                @"I", @"mobile_os",
                                @"EN", @"lang", nil];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMMddHHmmss"];

NSString *dateString1 = [dateFormatter stringFromDate:[NSDate date]];
NSString *dateString2 = [dateFormatter stringFromDate:[NSDate date]];

NSString *imageName1 = [NSString stringWithFormat:@"%@.jpg", dateString1];
NSString *imageName2 = [NSString stringWithFormat:@"%@.jpg", dateString2];

UIImage *image1 = [UIImage imageNamed:@"test1.png"];
UIImage *image2 = [UIImage imageNamed:@"test2.png"];

NSMutableDictionary *dataDic = [[NSMutableDictionary alloc] init];
[dataDic setObject:image1 forKey:imageName1];
[dataDic setObject:image2 forKey:imageName2];

[IVSHTTP asyncUpload:@"https://api.MYDOMAIN.com/upload"
        inputTagName:@"uploadFile"
          parameters:parameters
           dataArray:dataDic
             success:^(NSData *data) {
                   NSDictionary *dict = [IVSHTTP data2Cont:data];
                   NSLog(@"%@", dict);
           } failure:^(NSError *error) {
                   NSLog(@"%@", error.description);
           }];

syncUpload

NSData *data = [IVSHTTP syncUpload:@"https://api.MYDOMAIN.com/upload"
                      inputTagName:@"uploadFile"
                        parameters:parameters
                         dataArray:dataDic];

Requirements

  • Base SDK: iOS 10
  • Deployment Target: iOS 9.0 or greater
  • Xcode 8.x

Installation

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

pod "IVSHTTP"

Author

netcanis, [email protected]

License

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

Latest podspec

{
    "name": "IVSHTTP",
    "version": "0.1.3",
    "summary": "A simple, easy to use and lightweight HTTP library for Objective-C.",
    "homepage": "https://github.com/netcanis/IVSHTTP",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "netcanis": "[email protected]"
    },
    "source": {
        "git": "https://github.com/netcanis/IVSHTTP.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "IVSHTTP/**/*.{h,m,mm,c,cpp}",
    "frameworks": [
        "Foundation",
        "UIKit",
        "QuartzCore"
    ]
}

Pin It on Pinterest

Share This