CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

DTWebService 1.0

DTWebService 1.0

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Jun 2015

Maintained by Dimitris - Sotiris Tsolis.



  • By
  • Dimitris - Sotiris Tsolis

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