O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Posting to Facebook in iOS

Along with Twitter, iOS also supports adding a Facebook account via the settings, which allows applications, once they have permission, to gain access to your account without going through the full Facebook login.

How to do it...

First, you need to ensure you're set up on Facebook in the iOS settings. Launch the settings app, then go into Facebook and log in with your credentials. Once you've given permission to access your Facebook account, applications can make requests to use your credentials.

Once you're set up with Facebook, add the following code to the bottom of app.js:

var postToFacebookFromiOS = Ti.UI.createButton({ width : 280, height : 40, top : 430, left : 20, title : 'Post to Facebook from iOS', }); postToFacebookFromiOS.addEventListener("click", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required