I want to make it possible to post image to facebook in my app. I tried social plugin, but it did not work unless I just posted an URL and a picture from the URL. So i tried facebook plugin, but i got stuck really fast. When i called on the facebookListener the app just closed. I am very new to corona and this is my first app so it can be something obvious, but i have tried to get it to work for 2 days now.
Here is my main.lua file:
local facebook = require(“facebook”)
local fbAppID = “438465966325354”
local function facebookListener(event)
if ( “session” == event.type ) then
--options are “login”, “loginFailed”, “loginCancelled”, or “logout”
if ( “login” == event.phase ) then
local access_token = event.token
--code for tasks following a successful login
end
elseif ( “request” == event.type ) then
print(“facebook request”)
if ( not event.isError ) then
local response = json.decode( event.response )
--process response data here
end
elseif ( “dialog” == event.type ) then
print( “dialog”, event.response )
--handle dialog results here
end
end
local function fbLogin( event )
facebook.login( fbAppID, facebookListener)
end
local fbBtn = display.newCircle(340, 500, 100)
fbBtn:addEventListener(“tap”, fbLogin)
And her is my build.settings file:
settings =
{
plugins =
{
[“facebook”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true, [“iphone-sim”]=true },
},
},
iphone =
{
plist =
{
UIApplicationExitOnSuspend = false,
FacebookAppID = 438465966325354,
CFBundleURLTypes =
{
{CFBundleURLSchemes = { “fb438465966325354”,} }
},
[“URL types”] =
{
item =
{
[“URL Shemes”] = { [“item 0”] = “fb438465966325354” },
},
},
}
}
}
Information about my facebook app:
App ID: 438465966325354
Bundle ID: the id i used to make the development provisioning profile that i used to build the app for ios
iPhone Store ID and iPad Store ID: i used the Apple ID from a game i made earlier with another SDK
Single sign in: turned to “yes”
Deep linking: turned to “yes”