Post Images to Twitter With Corona SDK

REQUIREMENTS

INTRODUCTION / DISCLAIMER

Corona Labs is in the process of integrating native Twitter support into their framework, but hasn't given any estimate on completion. They have provided a nice tutorial on how to tweet using the Twitter Rest API, but does not explain some of the more advanced twitter API features. One of these highly anticipated features is posting images. Uploading images to twitter is a bit more complicated in Corona SDK. Hopefully everyone has been able to play around with the Twitter API source code example included in the Corona SDK. I will be building off of that code for this tutorial. I will also be using a very nice lua class for uploading multipart form data, created by Brill Pappin at Sixgreen Labs Inc. (www.sixgreen.com).

I must also mention that this short tutorial was put together in quite a hurry, so the code will not be as clean and organized as it should be. I could have spent a few hours turning the code into a nice clean class for easy distribution, but who has that kind of time?

This code was created for our newest title "Political Arena."  We have integrated Facebook and Twitter into the game for the purpose of sharing pictures from your in-game photo album. The photo album is populated with random screenshots of key moments throughout each fight.

I have quite a bit to say, and not nearly enough time to explain it all, so this tutorial may appear rushed. I am completely open to all comments and corrections. If you need more information, don't hesitate to contact me directly. Continue reading