Hi So I’m trying to get my app to post a status on Facebook. My code does post a status but only the second time I tap on the button. The first time the button is clicked, the user is redirected to the Facebook permission page, then because I’m asking for the ‘publish_actions’ permission, another Facebook permission page appears. When I tap the button to allow the app to post status, the Facebook permission page closes and I’m back to my app. The problem is that, even if I coded it to post status immediately, it doesnt do so, it does post the status if I click on the button again. If I click the button the 2nd time, the Facebook permission page pops out again every single time but is just black screen and quickly fades away. Is this a natural behavior? Does this black screen always appear every time I post a status even if I’m already logged in? If this can be solved, how do I get rid of the black screen to appear? And why doesn’t my app post the status after the 1st login? I’ve been working on this problem for 1 week and still to no avail. One more thing, if my app logs in to Facebook and the app exits. If the user plays the app again, do I have to run the facebook login code again? This is my code so far… I’ve also attached screenshot of the app activity (Black screen appears everytime I post status). Thank you.
local function listener( event ) print( "event.name", event.name ) --"fbconnect" print( "event.type:", event.type ) --type is either "session", "request", or "dialog" print( "isError: " .. tostring( event.isError ) ) print( "didComplete: " .. tostring( event.didComplete ) ) --"session" events cover various login/logout events --"request" events handle calls to various Graph API calls --"dialog" events are standard popup boxes that can be displayed if ( "session" == event.type ) then --options are: "login", "loginFailed", "loginCancelled", or "logout" if ( "login" == event.phase ) then local access\_token = event.token facebook.request( "me/feed", "POST", { message="I scored ".. myData.score.." in FreakOMath. Try and beat my score!" } ) end elseif ( "request" == event.type ) then print("facebook request") if ( not event.isError ) then local response = json.decode( event.response ) end elseif ( "dialog" == event.type ) then print( "dialog", event.response ) end end local function buttonTouch(event) --take in the event and get the associated display object local myButtons = event.target --now find out which button it is local nameString = myButtons.id --use began and ended phases to change text based on touches if event.phase == "began" then --set the label text to the id elseif event.phase == "ended" then if nameString == "button0" then myData.score = 0 ads.hide() composer.gotoScene( "scene2", "slideLeft", 250 ) elseif nameString == "button1" then --replace with your Facebook App ID facebook.login( fbAppID, listener, {"publish\_actions"}) end end return true end