Hi,
I’m working on app and want to post save image on facebook but enable to post that that image.I heve changed my build.setting file also. It’s not displaying photo on facebook.
I don’t know what doing wrong.
Any help?
Here is my code.
[lua]local fbAppID = “215674705207073” --fake
local function onLoginSuccess()
– Upload ‘entireScreen.jpg’ to current user’s account
local attachment = {
message = “I’ve Drawn!”,
name=“Do you think you can draw better image than this?”,
caption=“Colour Carnivals!”,
link=“http://www.thetinytapps.com”,
source = { baseDir=system.ResourceDirectory, filename=“entireScreen.jpg”, type=“image” } or { baseDir=system.DocumentsDirectory, filename=“entireScreen.jpg”, type=“image” },
native.showAlert( “wait”, “Searching image from resource directory.”, { “OK” } )
}
native.showAlert( “Success”, “Login successfully done.”, { “OK” } )
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()
native.showAlert( “Success”, “calling Login page.”, { “OK” } )
elseif event.type == “request” then
– this block is executed upon successful facebook.request() call
native.showAlert( “Wait”, “The photo uploading is in process.”, { “OK” } )
native.showAlert( “Success”, “The photo has been uploaded.”, { “OK” } )
else
------not loading photo---------
native.showAlert( “Failed”, “The photo is not uploaded.”, { “OK” } )
end
end
end
if ( fbAppID ) then
postmymsg = function(event)
print(“Tapped on Facebook Button”)
if fbCommand ~= POST_PHOTO then
fbCommand = POST_MSG
end
facebook.login( fbAppID, fbListener, { “publish_stream” } )
end
fbButton:addEventListener(“tap”, postmymsg)
end
---------my build setting code--------
[lua]UIApplicationExitsOnSuspend = false,
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fb215674705207073”,
}
}
}, [import]uid: 75428 topic_id: 23956 reply_id: 323956[/import]