Making Facebook Code App Store Ready

Ansca’s Facebook code just keeps trying to connect if you attempt to login to Facebook when there’s no network connection. This seems like a sure way to get rejected in the App Store. Does anyone have a way to put a cancel window over the Facebook network activity indicator page?

Or a way to check for network access prior to attempting it so the FB button can be hidden if there’s no connection?

This is the basic Ansca connection handler:
[lua]local function connectHandler( event )
local post = “hello and goodbye!”

local session = event.sender
if ( session:isLoggedIn() ) then

print( "fbStatus " … session.sessionKey )

local attachment = {
name=“I scored " … points … " in Example”,
href=“http://www.example.com”,
media= { { type=“image”, src=“http://www.example.com/image.png”, href=“http://www.example.com” } }
}

local action_links = {
{ text=“Learn more”, href=“http://www.blocfall.com” }
}

local response = session:call{
method =“stream.publish”,
attachment = json.encode(attachment),
action_links = json.encode(action_links),
}

if “table” == type(response ) then
statusMessage.textObject.text = “Post failed”

– print contents of response upon failure
printTable( response, “fbStatus response:”, 5 )
else
statusMessage.textObject.text = “Post published”
end
end
end[/lua] [import]uid: 1560 topic_id: 3273 reply_id: 303273[/import]

Excellent question and comment. Here’s one solution from the Corona community (actually two solutions, check the comments):

http://developer.anscamobile.com/code/check-internet-connection

I will add a similar check to the Facebook sample code. thanks!

Tim [import]uid: 8196 topic_id: 3273 reply_id: 10161[/import]