I got Facebook posting to work with two apps recently, with the latest builds. Here’s the settings I change whenever I create a new app (everything else I leave how it is):
ABOUT
Fill in all the details for your app.
–
WEB SITE
I fill out my website url, I don’t think this really matters.
–
FACEBOOK INTEGRATION
Leave as-is.
–
MOBILE AND DEVICES
I select HTML5 / mobile web and also enter my app store ID for the app. It’ll work if you don’t enter the app, but I notice if you do, it adds some extra app info to your wall post.
–
ADVANCED
Leave as-is.
And here’s the code that I use to get facebook posting to work. NOTE: It can be attached to a ui button, or anything really, BUT NOT a native.showAlert. For some reason, the Facebook dialog won’t work if you use it in conjunction with a native.showAlert() call. I submitted a bug about it already.
So as long as you’re not using a native.showAlert() call (to say, ask them if they want to post to their facebook wall), then the below code should work just fine:
[blockcode]
local callFacebook = function()
local facebookListener = function( event )
if ( “session” == event.type ) then
– upon successful login, update their status
if ( “login” == event.phase ) then
local gameScore = 123456
gameScore = tostring( gameScore )
local theMessage = “just scored a " … gameScore … " playing an awesome game.”
facebook.request( “me/feed”, “POST”, {
message=theMessage,
name=“Download This Awesome Game to Compete with Me!”,
caption="Think you can beat my score of " … gameScore … “? I dare you to try!”,
link=“http://link-to-your-app-website-or-itunes-page”,
picture=“http://link-to-90x90-image” } )
end
end
end
facebook.login( “FACEBOOK APP ID”, facebookListener, { “publish_stream” } )
end
callFacebook()
[/blockcode]
In the above code, replace:
…With their relevant counterparts.
Then just use ‘callFacebook()’ whenever you need a status message posted to their wall. Attach it to a ui button, a touch event, or wherever you want (except a native.showAlert!).
Hope that helps… [import]uid: 7849 topic_id: 4908 reply_id: 15905[/import]