In the past I’ve posted about how to extra data from web services, particularly parsing XML and JSON. Some web services are much simpler than this, and don’t require that level of overhead. An example of this service is the Gravatar service (for those who don’t know those little images you see beside comments are typically from users registered on Gravatar.com).
In order to get a gravatar all you need to do is encrypt the user’s e-mail into an MD5 hash, add that information to a URL associated with the gravatar api, and in return gravatar.com will send you the URL of the image.
Mugunth Kumar has created a tutorial illustrating this process here:
Add Gravatar Support To Your App
1. The “CommonCrypto/CommonDigest.h” includes a function known as CC_MD5 which allows you to convert the user’s e-mail into a MD5 hash tag.
2.From there it’s simply a matter of accessing the URL on gravatar at “http://www.gravatar.com/avatar/HASH” and that will give you the URL of the user’s avatar.
Mugunth has also added a sample project on Github:
There probably aren’t many situations when you’ll specifically need Gravatars in your app, but it’s especially good to know how to perform the MD5 encryption, as it is commonly required by web api’s.
Thanks for reading, please share this using the buttons below!
[Via: Under The Bridge]
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.