Have a problem trying to get Facebook friends names and pictures.
I can post Facebook messages on the users wall, so everything is setup right with plugins and stuff.
Here’s my code. No errors. Just an emply table.
What Am I doing wrong?
local facebook = require "facebook"; local json = require "json"; local facebookHelper = {}; local appID = "1588028748098867"; facebookHelper.getUsers = function(message) native.setActivityIndicator(true); local listener; listener = function(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then facebook.request( "me/friends" ) native.setActivityIndicator(true); end elseif ("request" == event.type) then local response = json.decode( event.response ) local data = response.data print("response:",event.response) native.setActivityIndicator(false); if data then --and ( not event.isError ) then local function showImage( event ) event.target.alpha = 0 event.target.xScale = 0.25 event.target.yScale = 0.25 transition.to( event.target, { alpha = 1.0 , xScale = 1, yScale = 1} ) end for i=1,#data do print("Name:",data[i].fullName) display.loadRemoteImage("http://graph.facebook.com/".. data[i].id .."/picture", "GET", showImage, "friend"..i..".png", system.TemporaryDirectory, math.random(0,display.contentWidth), math.random(0,display.contentHeight) ) end end end native.setActivityIndicator(nil); end facebook.login(appID, listener, {"publish\_actions"}); end