I have a feeling I am doing something very stupid. My setup is as follows:
main.lua contains the facebook listener which is designed to post an image saved from a displaygroup (User asking for help on Facebook) which is very minimal and looks as follows:
function listener( event ) print ("Facebook Listener Activated...") if ( "session" == event.type ) then if ( "login" ~= event.phase ) then showPopup("Logging into Facebook failed", "Please check your Internet connection.") return end access\_token = event.token if fbCommand == POST\_PHOTO then local attachment = { message = "Stuck on level ".. playlevel .. " of Game.", source = { baseDir=system.DocumentsDirectory, filename="quiz.jpg", type="image" } } facebook.request( "me/photos", "POST", attachment ) fblastaction = "processing" end elseif ( "request" == event.type ) then local response = event.response if ( not event.isError ) then if fbCommand == GET\_USER\_INFO then response = json.decode( event.response ) elseif (fbCommand == POST\_MSG) or (fbCommand == POST\_PHOTO) then showPopup("Game Name", "Thank you for posting to Facebook.") savegame() fblastaction = "posted" end else if appfb == 0 then showPopup("Facebook post failed", "Please check your Internet connection and try again.") end fblastaction = "error" end end end function postPhotoToWall(msg) print("Posting Photo to wall " .. appId) fbmessage = msg fbCommand = POST\_PHOTO facebook.login( appId, listener, {"publish\_actions", "email"} ) end
game-scene has all graphics in display groups which are generated during the scene:createScene event plus Admob ads showing. This then calls the Facebook post command with:
display.save( quizlayer, "quiz.jpg" ) postPhotoToWall("Playing Game")
The good news is that the routine works - it saves the file to the user directory and successfully makes the post to Facebook which can be seen in the timeline.
However, the screen goes blank as normal during the Facebook post. Once control is returned, I am left with a blank screen and only the Admob banner showing. It looks as if all my display groups have been lost.
I have nothing in the game-scene listeners to purge or remove the scene and am at a loss as to what the cause is.
Has anyone seen this behaviour before?