how to show 'https://graph.facebook.com/'+Ti.Facebook.uid+'/name' as a string

You must Login before you can answer or comment on any questions.

hi guys

how to show a url ==> 'https://graph.facebook.com/'+Ti.Facebook.uid+'/name', as a string (so the username from the person who has logged in with FB)

same idea as showing a picture ==> var profileView = Ti.UI.createImageView({ image:'https://graph.facebook.com/'+Ti.Facebook.uid+'/picture', });

— asked 2 years ago by Napp Dev
0 Comments

1 Answer

var label = Ti.UI.createLabel({text: 'https://graph.facebook.com/'+Ti.Facebook.uid+'/name'});

— answered 2 years ago by Stephen Feather
answer permalink
4 Comments
  • hi stephen,

    i tried this already and it does not show me the users name but rather the url

    — commented 2 years ago by Napp Dev

  • ok, you didn't ask clearly enough.

    Doesn't /name return JSON, so grab the URL with an httpClient call and parse the json to get the data you need.

    — commented 2 years ago by Stephen Feather

    • The FaceBook Graph API is REALLY well documented when compared to other APIs. https://developers.facebook.com/docs/reference/api/ Before asking how to integrate a 3rd party API with Titanium, please at least try to understand the 3rd party API first. (even if Titanium has built in support, you are still responsible for understanding both ends)

    • https://graph.facebook.com/appId/picture returns a binary stream.

    • https://graph.facebook.com/appId returns a JSON array. You will need to use Ti.Network.HTTPCLient to grab the JSON array returned from Graph

    Ex: https://graph.facebook.com/295053353871174 returns:

    "id": "295053353871174",
       "name": "Conversion Center",
       "link": "https://www.facebook.com/apps/application.php?id=295053353871174",
       "namespace": "conversion_center",
       "icon_url": "http://photos-g.ak.fbcdn.net/photos-ak-snc7/v85005/234/295053353871174/app_2_295053353871174_7250.gif",
       "logo_url": "http://photos-h.ak.fbcdn.net/photos-ak-snc7/v85005/234/295053353871174/app_1_295053353871174_5307.gif"
    }

    — commented 2 years ago by Stephen Feather

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!