gtsaousidis / DTWebService

A wrapper to make HttpRequests with the ability to ignore invalid SSL certificates and a NSURLRequest category that supports custom headers and files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DTWebService

Platforms

Podspec

This is a wrapper to make HttpRequests and a NSURLRequest category that supports custom headers and files. Among other things, the web service, has the ability to ignore invalid SSL certificates (by setting trusted hosts). It also using blocks to track a successful's request response data, failure or the progress percentage of the request.

Install

  • Old fashioned way of copy-paste the DTWebService folder into your project
  • Using CocoaPods. Add pod 'DTWebService' to Podfile.

Example usage

Example 1: Make a simple request (changing the sendAsyncRequest: to sendTrustedRequest: will ignore any invalid SSL certificate)

[DTWebService sendAsyncRequest:request finishedBlock:^(NSData *data, NSStringEncoding stringEncoding) {
    // handle completion
} fail:^(NSError *error, BOOL cancelled) {
    // handle failure
} progress:^(float progressPercentage) {
    // handle progress (update ui etc.)
}];

Example 2: Make a cancelable request

DTWebService *webService = [[DTWebService alloc] initWithURL:[NSURL URLWithString:@"a url..."]];
[webService startWithFinishedBlock:^(NSData *data, NSStringEncoding stringEncoding) {
    
} fail:^(NSError *error, BOOL cancelled) {
    
} progress:^(float progressPercentage) {
    
}];

....

[webService stop]; // stop/cancel the request

License

Apache licensed, as found in the LICENSE.md file.

About

A wrapper to make HttpRequests with the ability to ignore invalid SSL certificates and a NSURLRequest category that supports custom headers and files.

License:Other


Languages

Language:Objective-C 96.8%Language:Ruby 3.2%