guys,
I just want to take a picture of a display group and sent it to fb…
when i check the sandbox the image is getting created…
however it doesn’t seem to post on FB…
what am I missing?
[code]
local facebook = require “facebook”
– You must use your own app id for this sample to work
local fbAppID = “XXXXXXXXXXXXX” --fake
local function onLoginSuccess()
– Upload ‘iheartcorona.jpg’ to current user’s account
local attachment = {
message = “Just a description of the photo.”,
source = { baseDir= system.TemporaryDirectory, filename=“test.jpg”, type=“image” }
}
facebook.request( “me/photos”, “POST”, attachment )
end
– facebook listener
local function fbListener( 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
onLoginSuccess()
elseif event.type == “request” then
– this block is executed upon successful facebook.request() call
native.showAlert( “Success”, “The photo has been uploaded.”, { “OK” } )
end
end
end
local myObject1 = display.newRect( 50, 50, 100, 150 ) – Create a rectangle object
local myObject2 = display.newCircle( 100, 300, 50 ) – Create a circle object
local g = display.newGroup()
g:insert(myObject1)
g:insert(myObject2)
local btn = display.newRect( 200, 200, 100, 150 )
local function postFB(e)
if (e.phase == “ended”) then
local baseDir = system.TemporaryDirectory
display.save( g, “test.jpg”, baseDir )
– photo uploading requires the “publish_stream” permission
facebook.login( fbAppID, fbListener, { “publish_stream” } )
end
end
btn:addEventListener( “touch”, postFB )
[/code] [import]uid: 67619 topic_id: 24163 reply_id: 324163[/import]
[import]uid: 67619 topic_id: 24163 reply_id: 97521[/import]