Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created October 31, 2011 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronksaunders/1326759 to your computer and use it in GitHub Desktop.
Save aaronksaunders/1326759 to your computer and use it in GitHub Desktop.
Clearly Innovative Appcelerator iOS5 Twitter Module Example Code
/**
* 2011 - Clearly Innovative Inc
*
* ios5Twitter Example Code
*
* blog.celarlyinnovative.com
*/
var window = Ti.UI.createWindow({
backgroundColor: 'white'
});
var label = Ti.UI.createLabel();
window.add(label);
window.open();
// TODO: write your module tests here
var ios5twitter = require('clearlyinnovative.ios5twitter');
Ti.API.info("module is => " + ios5twitter);
var tw = ios5twitter.create();
/**
* @params data {Object} pass in a dictionary of the twitter items
* @params callback {function} called when method has been completed
*/
var f = Ti.Filesystem.getFile('new_logo.jpg');
tw.tweetThis({
"tweetURL": "http://blog.clearlyinnovative.com",
"tweetText": "clearlyinnovative appcelerator ios5 twitter module",
"tweetImage": f.read()
},
function(d) {
if (d.success) {
Ti.API.info(JSON.stringify(d));
} else {
// On error you get returned a dictionary with error information
// {
// "imageFit": true,
// "textFit": false,
// "urlFit": true,
// "type": "error",
// "source": {},
// "success": false
// }
Ti.API.info(JSON.stringify(d));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment