hi,
so i’m implementing facebook in my app now and everything is working smoth so far
BUT i have 2 questions if someone here knows about them it would be great !
so i’m doing the first login and i want to accomplish 2 things
to get the me/friends request AND to do the facebook.request( “me” )
do i really need to do TWO Seperate requests for that ?
that means 2 completely different >
facebook.login( facebookIdNumber, listener )
with 2 completely different listeners ?
can i even right them one after another and it won’t do any problems ?
as far as i under stand it
i get that the Facebook request was successful if i get a response in the > event.type == “request” ?
yea ?
and how do indicate if the user has canceled the window or simply didn’t connect… ?
local \_M = {} local facebook = require "facebook" local json = require "json" -- first argument is the app id that you get from Facebook function \_M.login () -- listener for "fbconnect" events local function listener( event ) if ( "session" == event.type ) then -- upon successful login, request list of friends if ( "login" == event.phase ) then facebook.request( "me/friends" ) end elseif ( "request" == event.type ) then -- event.response is a JSON object from the FB server local response = event.response -- if request succeeds, create a scrolling list of friend names if ( not event.isError ) then response = json.decode( event.response ) local friends = {} FBDataFriends = response.data -- uncomment this to see friends list --[[for i=1,#FBDataFriends do local name = FBDataFriends[i].name print ("yoru friend name: ") print (FBDataFriends[i].name) print ("your friend ID: ") print (FBDataFriends[i].id) print ("") end ]] end elseif ( "dialog" == event.type ) then print( "dialog", event.response ) end end facebook.login( facebookIdNumber, listener ) end return \_M