Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 2.22 KB

README.md

File metadata and controls

76 lines (51 loc) · 2.22 KB

CoreNetworking-iOS

Version License Platform CocoaPods Build Status

Wrapper project to simplify NSURLSession.

How to Install it

Podfile

platform :ios, '8.0'
pod 'CoreNetworking', '~> 1.0'

Old school

Drag into your project the folder /CoreNetworking-iOS. That's all.

Example

#import "CNMSession.h"
#import "CNMRequest.h"
#import "CNMURLSessionDataTask.h"

...

    CNMRequest *request = [[CNMRequest alloc] init];
    request.URL = [NSURL URLWithString:@"http://exampleapi.com/json"];
    
    CNMURLSessionDataTask *task = [[CNMSession defaultSession] dataTaskFromRequest:request];
    
    task.onCompletion = ^void(NSData *data, NSURLResponse *response, NSError *error)
    {
        if (!error)
        {
            // Raw data to JSON.
            NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
                                                                 options: NSJSONReadingMutableContainers
                                                                   error: nil];
        }
        else
        {
            NSLog(@"error %@", error);
        }
    };
    
    [task resume];

License

ButtonBackgroundColor-iOS is released under the MIT license. Please see the file called LICENSE.

Versions

$ git tag -a 1.0.0 -m 'Version 1.0.0'

$ git push --tags

Author

Gabriel Massana

##Found an issue?

Please open a new Issue here if you run into a problem specific to CoreNetworking-iOS, have a feature request, or want to share a comment.