Created
October 31, 2011 02:12
-
-
Save aaronksaunders/1326759 to your computer and use it in GitHub Desktop.
Clearly Innovative Appcelerator iOS5 Twitter Module Example Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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