【发布时间】:2015-12-30 02:03:40
【问题描述】:
我已将 Facebook 添加到我的应用程序中。
登录没问题,除了 facebook.login() 打开浏览器而不是本机 Facebook 应用程序,但是,当我调用 Facebook.showDialog() 时弹出窗口,但一两秒后它消失了。
请注意,我仅在 iOS 上会出现此行为,而在 Android 上则可以正常工作。
我在我的 game.lua 文件中使用以下代码:
local function facebookListener( event )
if ( "session" == event.type ) then
if ( "login" == event.phase ) then
local access_token = event.token
facebook.showDialog( "feed", { name = "SuperCool Game Coming soon", description = "Trying to figure out how to get my game to rule the world.", picture = "http://omnigeekmedia.com/wp-content/uploads/2011/05/omniblaster_promo-300x300.png", link = "http://www.omnigeekmedia.com/"})
end
elseif ( "request" == event.type ) then
print("facebook request")
if ( not event.isError ) then
local response = json.decode( event.response )
end
elseif ( "dialog" == event.type ) then
print( "dialog", event.response )
end
end
fbAppID = "my app ID" --replace with your Facebook App ID
function logOnFacebook(event)
if(event.phase=="ended")then
facebook.login( fbAppID, facebookListener, { "user_friends", "publish_actions" } )
end
end
["facebook"] =
{
publisherId = "com.coronalabs",
supportedPlatforms = { iphone = true, ["iphone-sim"] = true },
},
我正在构建 2015.2729 上运行。
我怎样才能设法让 Facebook 工作?
【问题讨论】:
标签: facebook login lua coronasdk showdialog