Tweet, Tweet right from your Lua App

How many times have we wanted to include functionality like Tweeting, etc from right inside of our Lua apps but only to face the walls of despair. These walls are called Roadmaps and even after a feature gets listed on the Roadmap, there is no guarantee that it will be included in the next few releases. So that would leave you with nothing but frustration. You pay a lot of money to get a license and only to find that the feature that you wanted is not there and won't be included till another 6 months or so.

Well, If you have planned to use Gideros, the first issue of having spend a lot of money would not exist, you can have the free license and no worries.

Second, if you use the Wax Plug-in from Andy and include it in your application, you are all set to use the iOS functionality.

Thirdly, in as many as about 2 to 3 lines of code, which is simply Amazing...

To tweet from our application, we need to first create the TweetComposerViewController, and then present it to the user. We could also add the functionality to check if the user tweeted or cancelled. In many cases that would hardly be of real concern, if the user wants to tweet it is fine, if they don't that is fine too.

So here's how you do it

   twit = TWTweetComposeViewController:init()
   twit:setInitialText("The tweet here")
   getRootViewController():presentModalViewController_animated(twit, true)

When it is run, your device might ask you for a login to associate the device with the twitter account and then send the tweets. The first time it does this, it would kind of kill your app, i.e. you might have to start again, so it is advisable to have a twitter account associated with your device before you test tweeting from it.

Well that's that to sending tweets from your app.


Comments

Popular Posts