Facebook graph api Facebook在main.lua上获取用户信息,但在应用程序内部调用时却无处获取

Facebook graph api Facebook在main.lua上获取用户信息,但在应用程序内部调用时却无处获取,facebook-graph-api,lua,ios-simulator,coronasdk,facebook-login,Facebook Graph Api,Lua,Ios Simulator,Coronasdk,Facebook Login,我正在尝试在我的应用程序中获取facebook的用户id和名称。当我尝试在不同的屏幕上登录facebook时,出现了一个不明错误。 当我从main.lua文件调用facebook登录屏幕时,我成功地在iOS simulator的调试器中获取用户名和id,如下所示,以及一些关于不影响登录的错误的更多信息 版本:3.0.0 建造日期:2015.2731 iOS模拟器9.1(13B137) 这意味着facebook登录成功,但当我点击“获取用户信息”按钮时,我得到了这个信息 Dec 1 13:20:

我正在尝试在我的应用程序中获取facebook的用户id和名称。当我尝试在不同的屏幕上登录facebook时,出现了一个不明错误。 当我从main.lua文件调用facebook登录屏幕时,我成功地在iOS simulator的调试器中获取用户名和id,如下所示,以及一些关于不影响登录的错误的更多信息

版本:3.0.0

建造日期:2015.2731

iOS模拟器9.1(13B137)

这意味着facebook登录成功,但当我点击“获取用户信息”按钮时,我得到了这个信息

Dec  1 13:20:19 --- last message repeated 8 times ---
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]: Already logged in with needed permissions
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]: Access Token Data
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [lastRefreshed] = 1448955307.3914
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [token] = [A long token here]
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [appId] = [My app ID]
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [expiration] = 1454138523.2562
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [    DeclinedPermissions] = table: 0x787bd360
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  {
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  }
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [userId] = 933164140108321
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [grantedPermissions] = table: 0x78702b10
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  {
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [1] = user_friends
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [2] = publish_actions
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  [3] = public_profile
Dec  1 13:20:19 Akashs-MacBook-Pro Spades[10091]:  }
Dec  1 13:20:24 Akashs-MacBook-Pro assertiond[3139]: assertion failed: 14F27 13B137: assertiond + 13207 [2F0DDEBE-B278-35C0-8523-3236DA94649E]: 0x1
Dec  1 13:20:28 --- last message repeated 5 times ---
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]: Already logged in with needed permissions
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]: Access Token Data
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [lastRefreshed] = 1448955307.3914
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [token] = [A long token here]
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [appId] = [My app ID]
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [expiration] = 1454138523.2562
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [    DeclinedPermissions] = table: 0x7c3a6600
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  {
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  }
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [userId] = 933164140108321
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [grantedPermissions] = table: 0x7c3a65b0
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  {
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [1] = user_friends
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [2] = publish_actions
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  [3] = public_profile
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]:  }
Dec  1 13:20:28 Akashs-MacBook-Pro Spades[10091]: FBSDKLog: starting with Graph API v2.4, GET requests for /me should contain an explicit "fields" parameter
Dec  1 13:20:29 Akashs-MacBook-Pro accountsd[3184]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Dec  1 13:20:29 Akashs-MacBook-Pro accountsd[3184]: SecTaskCopyDebugDescription: Spades[10091]
Dec  1 13:20:44 Akashs-MacBook-Pro assertiond[3139]: assertion failed: 14F27 13B137: assertiond + 13207 [2F0DDEBE-B278-35C0-8523-3236DA94649E]: 0x1
直到昨天,我还收到了这两个错误,你现在可以在上面facebook用户信息工作的第一段代码中看到,所以我不确定这是否是真正的问题。 侦听器连接收到的正常消息。忽略。 初始化期间无法成功更新网络信息。 因为我使用的是Corona的facebook示例应用程序,所以它应该很容易为任何人复制。。只需将所有main.lua代码移动到另一个场景,并点击按钮调用该场景


这是我的facebook_login.lua文件,与corona的facebook示例应用程序差别不大

composer = require( "composer" )
scene = composer.newScene()

-- Save info in SQL
----------------------------------------
require( "ice" )
userInfo = ice:loadBox( "userInfo" )
--userInfo:clear() -- Clear all user Data
--userInfo:store()

-- Variables
------------------------------
sW = display.contentWidth -- Screen Width
sH = display.contentHeight -- Screen Height
centerX = display.contentCenterX
centerY = display.contentCenterY

_W = display.contentWidth
_H = display.contentHeight

-- Comment out the next line when through debugging your app.
io.output():setvbuf('no') -- debug: disable output buffering for Xcode Console

widget = require("widget")
facebook = require("plugin.facebook.v4")
json = require("json")

-- Facebook Commands
fbCommand = ""; -- forward reference
LOGOUT = 1
SHOW_FEED_DIALOG = 2
SHARE_LINK_DIALOG = 3
POST_MSG = 4
POST_PHOTO = 5
GET_USER_INFO = 6
PUBLISH_INSTALL = 7

-- Layout Locations
ButtonOrigX = 160
ButtonOrigY = 300
ButtonYOffset = 35
StatusMessageY = 420 -- position of status message


-- Create Game
------------------------------
function scene:create( event )

    sceneGroup = self.view

    Rest of the code here is from Corona's facebook sample app

end

function scene:show( event )
    sceneGroup = nil
    sceneGroup = self.view
    phase = event.phase

    prevScene = composer.getSceneName( "previous" )
    if prevScene then
        composer.removeScene(prevScene)
    end

    if phase == "will" then
        -- Called when the scene is still off screen and is about to move on screen
    elseif phase == "did" then
        -- Called when the scene is now on screen
        -- 
        -- INSERT code here to make the scene come alive
        -- e.g. start timers, begin animation, play audio, etc.
    end
end

function scene:hide( event )
sceneGroup = nil
sceneGroup = self.view
phase = event.phase

if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
end

function scene:destroy( event )
sceneGroup = nil
sceneGroup = self.view

-- Called prior to the removal of scene's "view" (sceneGroup)
-- 
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
end

---------------------------------------------------------------------------------

-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
-----------------------------------------------------------------------------------------

return scene
composer = require( "composer" )
scene = composer.newScene()

-- Save info in SQL
----------------------------------------
require( "ice" )
userInfo = ice:loadBox( "userInfo" )
--userInfo:clear() -- Clear all user Data
--userInfo:store()

-- Variables
------------------------------
sW = display.contentWidth -- Screen Width
sH = display.contentHeight -- Screen Height
centerX = display.contentCenterX
centerY = display.contentCenterY

_W = display.contentWidth
_H = display.contentHeight

-- Comment out the next line when through debugging your app.
io.output():setvbuf('no') -- debug: disable output buffering for Xcode Console

widget = require("widget")
facebook = require("plugin.facebook.v4")
json = require("json")

-- Facebook Commands
fbCommand = ""; -- forward reference
LOGOUT = 1
SHOW_FEED_DIALOG = 2
SHARE_LINK_DIALOG = 3
POST_MSG = 4
POST_PHOTO = 5
GET_USER_INFO = 6
PUBLISH_INSTALL = 7

-- Layout Locations
ButtonOrigX = 160
ButtonOrigY = 300
ButtonYOffset = 35
StatusMessageY = 420 -- position of status message


-- Create Game
------------------------------
function scene:create( event )

    sceneGroup = self.view

    Rest of the code here is from Corona's facebook sample app

end

function scene:show( event )
    sceneGroup = nil
    sceneGroup = self.view
    phase = event.phase

    prevScene = composer.getSceneName( "previous" )
    if prevScene then
        composer.removeScene(prevScene)
    end

    if phase == "will" then
        -- Called when the scene is still off screen and is about to move on screen
    elseif phase == "did" then
        -- Called when the scene is now on screen
        -- 
        -- INSERT code here to make the scene come alive
        -- e.g. start timers, begin animation, play audio, etc.
    end
end

function scene:hide( event )
sceneGroup = nil
sceneGroup = self.view
phase = event.phase

if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
end

function scene:destroy( event )
sceneGroup = nil
sceneGroup = self.view

-- Called prior to the removal of scene's "view" (sceneGroup)
-- 
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
end

---------------------------------------------------------------------------------

-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
-----------------------------------------------------------------------------------------

return scene