Hey all,
I had the old Facebook thing down but this new one… I don’t get it. Frankly I’m near the point of tears out of insane frustration.
I just want my Facebook stuff to work again and I don’t understand how to make that happen.
Here is my old code;
local function printTable( t, label, level )
if label then print( label ) end
level = level or 1
if t then
for k,v in pairs( t ) do
local prefix = ""
for i=1,level do
prefix = prefix .. "\t"
end
print( prefix .. "[" .. tostring(k) .. "] = " .. tostring(v) )
if type( v ) == "table" then
print( prefix .. "{" )
printTable( v, nil, level + 1 )
print( prefix .. "}" )
end
end
end
end
local function connectHandler( event )
local post = "hello and goodbye!"
local session = event.sender
if ( session:isLoggedIn() ) then
print( "fbStatus " .. session.sessionKey )
local scoreStatusMessage = "I just scored " .. tostring(testscore) .. " on Happy Doodle Sushi Smile!"
local attachment = {
name="Download Happy Doodle Sushi Smile To Compete With Me",
caption="Think you can beat my score of " .. tostring(testscore) .. "? I dare you to try!",
href="http://itunes.apple.com/us/app/happy-doodle-sushi-smile/id404532572?mt=8",
media= { { type="image", src="http://peachpellen.com/hdss.png", href="http://itunes.apple.com/us/app/happy-doodle-sushi-smile/id404532572?mt=8" } }
}
local action\_links = {
{ text="Get It Now!", href="http://itunes.apple.com/us/app/happy-doodle-sushi-smile/id404532572?mt=8" }
}
local response = session:call{
message = scoreStatusMessage,
method ="stream.publish",
attachment = json.encode(attachment),
action\_links = json.encode(action\_links),
}
if "table" == type(response ) then
native.showAlert( "Oh no!", "Your post couldn't be published. Please try again shortly.", { "Aww :(" }, onComplete )
-- print contents of response upon failure
printTable( response, "fbStatus response:", 5 )
else
native.showAlert( "Success!", "Your post has been published. Thanks for sharing your score with friends!", { "You're Welcome!" }, onComplete )
end
end
end
---------------------------------------------------------------------------------------------------
-- NOTE: To create a mobile app that interacts with Facebook Connect, first log into Facebook
-- and create a new Facebook application. That will give you the "API key" and "application secret"
-- that should be used in the following lines:
local fb\_api\_key = "11d3ed3c5cd2d9xxxxxxxxxxxxxx"
local fb\_secret = "b4a165105fxxxxxxxxxxxxxxxxxxx"
---------------------------------------------------------------------------------------------------
if ( fb\_api\_key and fb\_secret ) then
-- Create Facebook connection object
local session = facebook.newConnection( fb\_api\_key, fb\_secret )
local function onRelease( event )
-- call the login method of the FB session object, passing in a handler
-- to be called upon successful login.
session:login( connectHandler )
end
-- "Connect with Facebook" button
local fbButton = ui.newButton{
default = "facebook.png",
over = "facebook.png",
onRelease = onRelease,
x = 160,
y = 390
}
localGroup:insert(fbButton)
else
local function onComplete( event )
system.openURL( "http://developers.facebook.com/get\_started.php" )
end
native.showAlert( "Error", "To develop for Facebook Connect, you need to get an API key and application secret. This is available from Facebook's website.", { "Learn More" }, onComplete )
end
I get that it isn’t perfect but by using the example available it actually worked.
This new thing, http://developer.anscamobile.com/node/3802
I don’t get it at all.
I can’t make anything work and I’m horribly upset >.
If anyone could please show me how to get this working and posting with the new Facebook stuff I’d be really, really happy about it.
Peach [import]uid: 10144 topic_id: 4522 reply_id: 304522[/import]
[import]uid: 10144 topic_id: 4522 reply_id: 14380[/import]
[import]uid: 10144 topic_id: 4522 reply_id: 14411[/import]