facebook.showDialog issue (dialog keeps closing)

My app is getting restricted by Facebook because it directly posts to users’ walls without allowing them to edit the posted message. So, I’m switching from facebook.request to facebook.showDialog. It was very straightforward to make this transition. However, while everything seems to work fine the first time you share after the app is first loaded onto the device, during every subsequent share attempt, whether I actually shared or pressed cancel during the first dialog, the dialog will open for a second and then immediately close. No errors are reported in Console and none of the debugging messages I’ve put in have helped me nail this down.

I have used Corona Builds 922 and 942 with the same results.

Below is a sample of the relevant code:

local FB\_App\_ID = "XXXXXXXXXXXXXXX"  
  
local contactFB = function(evt)  
 local fbLink = "http://appwebsite.com"  
 local fbText = "App description"  
  
 facebook.showDialog("feed", {  
 name = "App Name",  
 caption = "app caption",  
 description = fbText,  
 link = fbLink  
 })  
  
 return true  
end  
  
local fbListener = function(event)  
  
 if ( "session" == event.type ) then  
  
 -- upon successful login, request list of friends of the signed in user  
 if ( "login" == event.phase ) then  
   
 -- Fetch access token for use in Facebook's API  
 local access\_token = event.token  
  
 contactFB()  
  
 elseif event.phase == "logout" then   
   
 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  
 -  
 end  
 elseif ( "dialog" == event.type ) then  
 print( "dialog", event.response )  
 end  
end  
  
facebook.login( FB\_App\_ID, fbListener, {"publish\_stream"} )  

Any feedback would be appreciated! [import]uid: 44153 topic_id: 32609 reply_id: 332609[/import]

UPDATE: I’m only having this problem if I’m already signed into Facebook. When I use facebook.logout() after every post, the dialog works fine every time (except having to reopen the Facebook app each time, which is unacceptable). [import]uid: 44153 topic_id: 32609 reply_id: 129748[/import]

UPDATE: I’m only having this problem if I’m already signed into Facebook. When I use facebook.logout() after every post, the dialog works fine every time (except having to reopen the Facebook app each time, which is unacceptable). [import]uid: 44153 topic_id: 32609 reply_id: 129748[/import]

UPDATE 2: turns out the problem isn’t located in the code I provided. After extensive testing and comparing between my code and the Facebook sample code included with Corona (which works), I found the only real discrepancy between the two is that the sample code calls facebook.login from within a function assigned as the onRelease listener for a widget button whereas my code calls facebook.login from within the listener function assigned to a native.showAlert call.

Is there any reason why this would be the case or is this a bug? [import]uid: 44153 topic_id: 32609 reply_id: 130376[/import]

UPDATE 2: turns out the problem isn’t located in the code I provided. After extensive testing and comparing between my code and the Facebook sample code included with Corona (which works), I found the only real discrepancy between the two is that the sample code calls facebook.login from within a function assigned as the onRelease listener for a widget button whereas my code calls facebook.login from within the listener function assigned to a native.showAlert call.

Is there any reason why this would be the case or is this a bug? [import]uid: 44153 topic_id: 32609 reply_id: 130376[/import]