Wrapper project to simplify NSURLSession.
platform :ios, '8.0'
pod 'CoreNetworking', '~> 1.0'
Drag into your project the folder /CoreNetworking-iOS
. That's all.
#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];
ButtonBackgroundColor-iOS is released under the MIT license. Please see the file called LICENSE.
$ git tag -a 1.0.0 -m 'Version 1.0.0'
$ git push --tags
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.