Get Updates By E-mail 

Article Written By:
Johann Dowa

Easy To Use Objective-C Wrapper For The LibCurl Web Communications Library

  •  
  •  
  •  
  •  
  •  

There’s always been a lot of talk about using libCurl for web communications on the iOS platform with it’s vast protocol support and wide number of communications options.

Bruno de Carvalho has released a library called BBHotPotato that utilizes libCurl providing a nice concise syntax for your HTTP communication needs along with a build script so you can build your own static libCurl library for easy inclusion in your iOS projects.

Here’s an example of how you could use BBHotPotato to create a JSON request:

[[BBJSONRequest getFrom:@"http://foo.bar"] getJSON:^(id result) {
     NSLog(@"User email: %@", result[@"user.email"]);
     NSLog(@"# of followers: %@", result[@"[email protected]"]);
} error:^(NSError* error) {
// Handle request *or* JSON decoding error
}];

Using libCurl also allows you to avoid some errors that can occur when uploading with NSURLConnection. As Bruno stats in the BBHotPotato readme:

the motivation for this libcurl wrapper was that during development of Droplr’s API server, we noticed that whenever the API rejected an upload and immediately closed the connection — which is a perfectly legal & reasonable behavior — the Cocoa-based clients would keep reporting upload progress (even though I knew the socket was closed) and eventually fail with “Request timeout”, instead of the response the server had sent down the pipes.

You can find BBHotPotato on Github here.

You can find the build scripts allowing you to easily create a libCurl static library for iOS devices on Github here.

A great library and build script for those wanting to use libCurl within an iOS project.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments