Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

First app approved

Just had my first Ti iPhone app approved. It's very simple at the moment - maps your Facebook checkins so you can see your friends on a map, though the next update will have some more useful additions.

The biggest challenge was getting the new Facebook Graph API working in Titanium alongside Ti.Facebook because it uses the old REST API client.

Thanks to everyone who helped out getting started with Titanium.

iTunes link to the app:
http://itunes.apple.com/gb/app/checkins/id396409407?mt=8


Edit:

Facebook integration info:

In order to use the Graph API I had to use a Ti.Network.HTTPClient to make get and post requests. That was easy enough. At first I created the entire app using just the HTTPClient, using the desktop authentication method described here: http://developers.facebook.com/docs/authentication/desktop.

You can also use the normal web authentication described here:
http://developers.facebook.com/docs/authentication/

To do this you need to use a Ti.UI.WebView because this is how the user enters their username and password.

You need to subscribe to 'load' events on the WebView, and check the URL whenever it changes. When the URL matches the end point (depends on the application and the authentication method used), you can get the access token and append it to your Graph API requets.

That worked fine for me, but Facebook doesn't seem to provide a way to easily log out a user; which makes it difficult for someone else to use the app with their own data. In some situations that might be fine, but I wanted to allow 'guests' to login on a friends phone.

So, I used the normal Ti.Facebook login button to start and end sessions. Once the user is logged in, you can exchange their Facebook session for an access token:

See 'Exchange session key for an access token' here:
http://developers.facebook.com/docs/authentication/

Hope that helps

— asked October 13th 2010 by Charles Davison
  • iphone
0 Comments

3 Answers

  • cool man, congrats..I'm gonna d/l right now

    — answered October 13th 2010 by Ronnie Swietek
    permalink
    0 Comments
  • Any insights you care to share? I just sat down tonight to integrate the Facebook Ti functionality and the new graph API, I have seen snippits in some of the questions but nothing that made it click for me. I haven't moved on it yet so it will be a long night, I would appreciate any help you can provide.

    — answered October 13th 2010 by Brian Raymond
    permalink
    0 Comments
  • Awesome app, looks very clean! If you dont mind me asking, how did you get the new graph api to work with TI.facebook? I'm in the similar situation.

    — answered October 13th 2010 by Sj Singh
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.