发布到Facebook没有发布完整的消息

时间:2013-02-26 17:36:55

标签: facebook lua corona

我想将此消息发布到Facebook:I have achieved (".. scorepost,") points, playing... download for FREE iPhone & Android at www.site

但它只发布:我已达到1000) 1000是 math.random(100,1000); 的结果,该位正在运行并且正在发布每次都是正确的号码,但不是其余的:积分,玩...免费下载iPhone& Android网站www.site

local facebook = require "facebook"
local fbAppID = "appID" 

scorepost =  math.random(100, 1000);    
keeping_score = true
scoreText = display.newTmessageext( "Score: " .. scorepost,  20, 20,nil, 40)
scoreText:setTextColor(255,255,255)

local faceFunc = function ()

function onLoginSuccess()
  facebook.request( "me/feed", "POST", {message = "I have achieved (".. scorepost,") points, playing... download for FREE iPhone & Android at www.site"} )
end

-- facebook listener
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 post has been uploaded.", { "OK" } )
        end
    end
end

-- photo uploading requires the "publish_stream" permission
facebook.login( fbAppID, fbListener, { "publish_stream" } )

end

--Button to activate the post to facebook
local facebutton = display.newRect (0, 0, 50, 50)
facebutton.x = display.contentWidth/2; facebutton.y = display.contentHeight/2
facebutton:addEventListener("tap", faceFunc)

2 个答案:

答案 0 :(得分:2)

你不应该连接字符串;像这样:

facebook.request( "me/feed", "POST", {message = "I have achieved (".. scorepost .. ") points, playing... download for FREE iPhone & Android at www.site"} )

答案 1 :(得分:0)

你在得分后使用“,”而不是“..” 因此,假设得分为100,您发送的内容如下:

{
  "message":"I have achieved (1oo",
  ") points, playing... download for FREE iPhone & Android at www.site"
}