facebook.showDialog error: (NSURLErrorDomain error -999.)

Just when I thought I had this all working well…

Over a cellular connection, I am having problems with the facebook.showDialog() function.

Here is the code:

[lua]function fbLoginListener( event )
if event.isError then
native.showAlert( “ERROR”, event.response, { “OK” } )
else
if event.type == “session” and event.phase == “login” then
– login was a success; call function
facebookUser = true

settings:store( “facebook”, true )
settings:save()
end
end
end

function fbPostListener( event )
if event.isError then
native.showAlert( “ERROR”, event.response, { “OK” } )
else
if event.type == “session” and event.phase == “login” then
local myFacebookUpdate = {
name = “Name”,
caption = “Here’s the caption”,
description = “And a long decription goes here”,
link = “http://www.URL.com/”,
picture = “http://www.URL.com/images/facebookimage.png
}

facebook.showDialog( “feed”, myFacebookUpdate )
elseif event.type == “dialog” then
questionGroup:removeSelf()
questionGroup = nil

displayMenu()
end
end
end

function facebookLogin()
facebook.login( fbAppID, fbLoginListener, { “publish_stream” } )
end

function facebookPost()
facebook.login( fbAppID, fbPostListener, { “publish_stream” } )
end[/lua]

A button on the main menu calls facebookLogin(). It logs the user in through SSO, sets the permissions, and then sets the facebookUser var and uses Ice to save the value to a file.

Once the user completes the game action, the app checks to see if the facebookUser is set to true, and if so, calls facebookPost() to make sure the user is still logged in and to track when the dialog is closed. If the user is logged in, it does facebook.showDialog() which loads the dialog which is blank for a moment.

Then, what seems to be randomly, either the dialog content loads (Yay!) or an error message appears:
Error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)

When it happens, it only seems to happen the first time after the user has logged in. Play again and again and the dialog loads fine.

I don’t see how I can catch that error and prevent it from appearing and do something else, like close the dialog and try launching it again.

Here is information on that error:
http://stackoverflow.com/questions/4392317/i-am-getting-this-error-nsurlerrordomain-error-999

Two questions:

  1. Is there any way to catch this error and prevent it from showing and take some other action? (Based on what I have seen, I don’t think there is.)
  2. Is this something that the Corona folks need to add into their code to catch that error and provide something more palatable to the facebook.showDialog() function?

Help. :slight_smile: [import]uid: 17827 topic_id: 29025 reply_id: 329025[/import]

Not resolved, but I do realize that the error message appearing was coming from me. I thought that I had commented out the error message in the is.Error block, but clearly I had not. :slight_smile:

So at least I can catch the error.

My bad. :slight_smile: [import]uid: 17827 topic_id: 29025 reply_id: 117476[/import]

Hi there,

I’m having the same issue here - did you ever find a solution to the (NSURLErrorDomain error -999.) error?

Thanks in advance for any help!

 

Hi there,

I’m having the same issue here - did you ever find a solution to the (NSURLErrorDomain error -999.) error?

Thanks in advance for any help!