与朋友分享应用程序与Corona sdk免费版

Hem*_*lia 3 share facebook coronasdk

我想分享我在facebook中使用corona sdk免费版创建的应用程序.但没有在互联网上找到的工作实例.看来facebook api或政策有变化.有没有人最近在facebook集成的corona sdk中创建了应用程序?任何人都可以参考我们整合facebook的方式.

我发现另一个问题是通过facebook在电晕Sdk中分享我的应用程序,但答案中提供的链接已关闭.这将是greate = help.

facebook API有任何更新吗?因为我每次都得到响应null.任何人都可以提供最近创建的工作示例参考?

我在下面的回答中尝试了krs提供的示例,但它对我不起作用. https://developer.coronalabs.com/content/facebook 当我点击任何一个功能,如post Msg,它进入Facebook页面,经过一些处理,它直接进入主页再没有任何完成.在日志中我得到响应null.

以下是错误的屏幕截图.

在此输入图像描述

任何帮助对我都有很大的帮助.

编辑

我曾经尝试了很多,但同样的问题就在那里.我认为facebook app配置问题就在那里.任何人都可以提供详细的分步信息来配置应用程序并生成电晕版本吗?我为此给予另外100点赏金.

Dev*_*faR 5

我希望这有助于制作一个lua文件,并将它代码复制到你想要的任何地方

local facebook = require "facebook"
local json = require "json"

local _M = {}

local appId = "" -- put your app id string here

local message = ""
local access_token = ""
local fbCommand = ""

local LOGOUT = 1
local SHOW_DIALOG = 2
local POST_MSG = 3
local POST_PHOTO = 4
local GET_USER_INFO = 5
local GET_PLATFORM_INFO = 6

function showPopup(popupTitle,popupMessage)
    native.showAlert( popupTitle, popupMessage, {"OK"} )
end


function listener( event )
    if ( "session" == event.type ) then

        if ( "login" ~= event.phase ) then
            showPopup("Facebook share score failed!", "Please try again")
            return
        end

        print(access_token)
        access_token = event.token


        if fbCommand == GET_USER_INFO then
            facebook.request("me")
        elseif fbCommand == POST_MSG then

            facebook.request("me/feed", "POST"  , {message = message} )
        end
    elseif ( "request" == event.type ) then
        local response = event.response

        print("Response: ",response)

        if ( not event.isError ) then
            if fbCommand == GET_USER_INFO then
                response = json.decode( event.response )
            elseif fbCommand == POST_MSG then
                showPopup("Facebook share score", "You've successfully shared your score!")
            end
        else
            showPopup("Facebook share score failed!", "Please try again")
        end
    end
end

function _M:postToWall(msg)
    message = msg
    fbCommand = POST_MSG
    facebook.login( appId, listener, {"publish_stream"} )
end

function _M:shareGame()
    message = "Juggler http://google.com/"
    fbCommand = POST_MSG
    facebook.login( appId, listener, {"publish_stream"} )
end

return _M
Run Code Online (Sandbox Code Playgroud)

当你想分享使用这个功能

  local function FacebookShare(event)

        if event.phase == "began" then
            local FBManager
            local message

            FBManager = require( "Facebook" )
            message = "" -- your message
            FBManager:postToWall(message)
        end
    end
Run Code Online (Sandbox Code Playgroud)

如果用户没有登录,它将调用登录facebook.这对我有用,希望它能解决你的问题