2013-02-26 90 views
0

我試圖發佈此消息給Facebook:I have achieved (".. scorepost,") points, playing... download for FREE iPhone & Android at www.site發佈到Facebook發佈不完整的郵件

但它僅發佈:我已經實現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

不應該你連接字符串;像這樣:

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

您使用的是 「」 而不是 「..」 scorepost後, 因此,假設scorepost是100,您發送類似:

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