Facebook logs out after I post score

Hi,

Here’s my problem, the first time I share my score on Facebook it works fine, but when I try to do it again, it asks me to log in to Facebook again, but does nothing afterwards. In order to make it work I need to close and restart the app again. Also the logs show something like this:

 FBSDKLog: Cannot use the Facebook app or Safari to authorize, fbxxxxxxxxxxxx is not registered as a URL Scheme

What does this mean?

Thanks

What does your build.settings look like?  Can you post it here?

Rob

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", supported = { "portrait","portraitUpsideDown" } }, android = { versionCode = "1", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, }, iphone = { plist = { UIAppFonts = { "04B\_19\_.TTF", "Gotham-Bold\_0.otf", "walibi-holland\_0.ttf",w }, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png" }, UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend FacebookAppID ="1234567890", --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fb1234567890", } } } --]] } }, plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", }, ["CoronaProvider.ads.iads"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, } }

Here’s what my build settings look like

Thanks!

You have this commented out:

CFBundleURLTypes = {     {         CFBundleURLSchemes =         {              "fb1234567890",         }     } }

This has to be there for Facebook to talk to the native app to manage logins.

Rob

Hi, It still does the same thing. I can only post the first time when I launch the application. The only difference this time when I uncommented that part is that the Facebook login popup does not appear anymore, instead what happens is that the application exits and goes to the Facebook app but exits immediately. This shows in the log: 

arning>: CoreAnimation: updates deferred for too long

Jul 19 12:18:59 Ghosts-iPad backboardd[28] <Warning>: CoreAnimation: timed out fence 3377b

Jul 19 12:18:59 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436339.837378]: Foreground Network Application exited.

Jul 19 12:18:59 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436339.837857]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd dataaccessd UserEventAgent networkd apsd 

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436343.043500]: 

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: Too frequent(4.983046 secs) rssi event from driver

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.569235]: Foreground Network Application entered.

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.569886]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd dataaccessd UserEventAgent networkd apsd 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.571092]: problematic networks =  and potentially problematic networks = 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.571495]: Unblacklisting

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.604626]: No change in Background Scan candidates. Skip re-programming Background Scan

Is there more to your log?  There are no facebook related messages there.

Rob

Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.078879]: Low Accuracy Location Monitoring Timer Expired Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.079698]: Failed to get location information; setting locale to default locale Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.080413]: new locale: , locale: Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.081414]: Stopping Low Accuracy Location Monitoring Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.081885]: CLMonitoring is already stopped Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.082263]: Stopping Low Accuracy Location Monitoring Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.082826]: CLMonitoring is already stopped Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.246942]: Foreground Network Application entered. Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.247521]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd UserEventAgent networkd apsd Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.248120]: problematic networks = and potentially problematic networks = Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.248540]: Unblacklisting Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.262331]: No change in Background Scan candidates. Skip re-programming Background Scan Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.263185]: Already connected to CES-PC\_Network. Jul 19 23:07:29 Ghosts-iPad locationd[54] \<Notice\>: client 'com.facebook.Facebook' stopping significant location changes Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: updates deferred for too long Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: timed out fence 2b413 Jul 19 23:07:29 Ghosts-iPad SpringBoard[33] \<Warning\>: CoreAnimation: failed to receive fence reply: 10004003 Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: failed to send fence reply: 10000003 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.812046]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.812606]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.813055]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.814449]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.045143]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.047868]: Async scan request completed for "locationd" (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.051563]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.052107]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.052605]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.053056]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.467777]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.468403]: Async scan request completed for "locationd" (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.488739]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.489319]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.489961]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.490632]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.966605]: Foreground Network Application exited. Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.967393]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd UserEventAgent networkd apsd Jul 19 23:07:31 Ghosts-iPad kernel[0] \<Debug\>: AppleAP3GDL::handleInterrupt2 FIFO is Empty Jul 19 23:07:31 Ghosts-iPad awdd[2244] \<Error\>: CoreLocation: CLClient is deprecated. Will be obsolete soon. Jul 19 23:07:32 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475252.187614]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:32 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475252.188204]: Async scan request completed for "locationd" (0)

Here’s the code I use to log in:

function shareToFacebook(event) --check if the sharebutton was clicked local function onComplete(event) if(event.action=="clicked") then local i=event.index if(i==1) then postScore(event) elseif(i==2) then return end end end local function facebookListener(event) if(event.type=="session") then if("login"==event.phase) then native.showAlert("Facebook Share","Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Try and beat my score if you can!#eggoh!",{"Share","Cancel"},onComplete) local access\_token=event.token end elseif(event.type=="request") then if(not event.isError) then print("request success") onPostScoreComplete() end elseif(event.type=="dialog") then end end function postScore(event) facebook.request( "me/feed", "POST", { message="Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Try and beat my score if you can!#eggoh!",link="https://itunes.apple.com/us/app/eggoh!/id882359031?ls=1&mt=8",icon=AssetManager.GetGraphicsAsset("icon") },onPostScoreComplete) local access\_token = event.token end local appID="1234567890" facebook.login(appID, facebookListener, { "publish\_actions, email" } ) end

That’s all that I have for the moment. 

Thanks,

First I don’t see the onPostScoreComplete() function. 

Secondly, you can’t specify a callback function to facebook.request().  It’s going to call facebookListener, the callback you setup in the .login() call.

Third, Facebook requires two logins.  The first login, you do not request any permissions.  This gives you read-only access to the user’s me object.   If you want anything more, like “publish_actions”, you have to make a second call to facebook.login() after successfully logging in.

Fourth, Facebook now requires any app wanting publish_actions or other write permissions to get approval (or use a test app) before it will work.

Fifth, I see you have a print in your facebookListener function, but I don’t see where it’s showing up in the console log you posted (In fact, I don’t see anything that looks like it’s coming from Corona SDK.  You should consider adding more print statements in to see if you’re getting to the places in the code you think you are getting to.  Check some values to make sure they are what you expect, in particular, I’d like to see the access token at the different places.

Rob

Hi,

I don’t know what’s wrong but it is working again. Weird. I’ll get back to this thread if it re-occurs.

Thanks a lot!

Hi,

How should this work?:

Third, Facebook requires two logins.  The first login, you do not request any permissions.  This gives you read-only access to the user’s me object.   If you want anything more, like “publish_actions”, you have to make a second call to facebook.login() after successfully logging in.

Which function will be called by the second Facebook login?..

​So basically after log gin in? I should call login inside my first logins callback function?

Thanks,

-Tristan

Well Facebook would prefer you have a button somewhere that users have to tap to fire off that 2nd login.  User engagement is higher when the are not overwhelmed at the beginning of your app launch requesting permissions.  They would prefer the extra permissions be delayed until you actually need them, but you could call login again from the call back function.  However you  have to be careful with how you programming that call back function because the second login calls the same call back function (though technically you should be able to have a different function for the 2nd login…).

Rob

What does your build.settings look like?  Can you post it here?

Rob

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { orientation = { default = "portrait", supported = { "portrait","portraitUpsideDown" } }, android = { versionCode = "1", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", }, }, iphone = { plist = { UIAppFonts = { "04B\_19\_.TTF", "Gotham-Bold\_0.otf", "walibi-holland\_0.ttf",w }, CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png" }, UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend FacebookAppID ="1234567890", --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fb1234567890", } } } --]] } }, plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", }, ["CoronaProvider.ads.iads"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, } }

Here’s what my build settings look like

Thanks!

You have this commented out:

CFBundleURLTypes = { &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CFBundleURLSchemes = &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "fb1234567890", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; } }

This has to be there for Facebook to talk to the native app to manage logins.

Rob

Hi, It still does the same thing. I can only post the first time when I launch the application. The only difference this time when I uncommented that part is that the Facebook login popup does not appear anymore, instead what happens is that the application exits and goes to the Facebook app but exits immediately. This shows in the log: 

arning>: CoreAnimation: updates deferred for too long

Jul 19 12:18:59 Ghosts-iPad backboardd[28] <Warning>: CoreAnimation: timed out fence 3377b

Jul 19 12:18:59 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436339.837378]: Foreground Network Application exited.

Jul 19 12:18:59 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436339.837857]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd dataaccessd UserEventAgent networkd apsd 

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436343.043500]: 

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: Too frequent(4.983046 secs) rssi event from driver

Jul 19 12:19:03 Ghosts-iPad wifid[15] <Notice>: 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.569235]: Foreground Network Application entered.

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.569886]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd dataaccessd UserEventAgent networkd apsd 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.571092]: problematic networks =  and potentially problematic networks = 

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.571495]: Unblacklisting

Jul 19 12:19:11 Ghosts-iPad wifid[15] <Notice>: WiFi:[427436351.604626]: No change in Background Scan candidates. Skip re-programming Background Scan

Is there more to your log?  There are no facebook related messages there.

Rob

Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.078879]: Low Accuracy Location Monitoring Timer Expired Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.079698]: Failed to get location information; setting locale to default locale Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.080413]: new locale: , locale: Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.081414]: Stopping Low Accuracy Location Monitoring Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.081885]: CLMonitoring is already stopped Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.082263]: Stopping Low Accuracy Location Monitoring Jul 19 23:07:20 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475240.082826]: CLMonitoring is already stopped Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.246942]: Foreground Network Application entered. Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.247521]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd UserEventAgent networkd apsd Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.248120]: problematic networks = and potentially problematic networks = Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.248540]: Unblacklisting Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.262331]: No change in Background Scan candidates. Skip re-programming Background Scan Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.263185]: Already connected to CES-PC\_Network. Jul 19 23:07:29 Ghosts-iPad locationd[54] \<Notice\>: client 'com.facebook.Facebook' stopping significant location changes Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: updates deferred for too long Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: timed out fence 2b413 Jul 19 23:07:29 Ghosts-iPad SpringBoard[33] \<Warning\>: CoreAnimation: failed to receive fence reply: 10004003 Jul 19 23:07:29 Ghosts-iPad backboardd[28] \<Warning\>: CoreAnimation: failed to send fence reply: 10000003 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.812046]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.812606]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.813055]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:29 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475249.814449]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.045143]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.047868]: Async scan request completed for "locationd" (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.051563]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.052107]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.052605]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.053056]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.467777]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.468403]: Async scan request completed for "locationd" (0) Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.488739]: Async scan requested by "locationd" for 1 iterations with maxage=0 priority normal on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.489319]: Enqueuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.489961]: Dequeuing command type: "Scan" pending commands: 0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.490632]: Attempting Apple80211ScanAsync on en0 Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.966605]: Foreground Network Application exited. Jul 19 23:07:30 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475250.967393]: BG Application: Not Present, BG Daemon: Present. Daemons: sharingd UserEventAgent networkd apsd Jul 19 23:07:31 Ghosts-iPad kernel[0] \<Debug\>: AppleAP3GDL::handleInterrupt2 FIFO is Empty Jul 19 23:07:31 Ghosts-iPad awdd[2244] \<Error\>: CoreLocation: CLClient is deprecated. Will be obsolete soon. Jul 19 23:07:32 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475252.187614]: Completed Apple80211ScanAsync on en0 (0) Jul 19 23:07:32 Ghosts-iPad wifid[15] \<Notice\>: WiFi:[427475252.188204]: Async scan request completed for "locationd" (0)

Here’s the code I use to log in:

function shareToFacebook(event) --check if the sharebutton was clicked local function onComplete(event) if(event.action=="clicked") then local i=event.index if(i==1) then postScore(event) elseif(i==2) then return end end end local function facebookListener(event) if(event.type=="session") then if("login"==event.phase) then native.showAlert("Facebook Share","Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Try and beat my score if you can!#eggoh!",{"Share","Cancel"},onComplete) local access\_token=event.token end elseif(event.type=="request") then if(not event.isError) then print("request success") onPostScoreComplete() end elseif(event.type=="dialog") then end end function postScore(event) facebook.request( "me/feed", "POST", { message="Awesome!I got "..GameSettings.save.topScore.." points in EggOh! Try and beat my score if you can!#eggoh!",link="https://itunes.apple.com/us/app/eggoh!/id882359031?ls=1&mt=8",icon=AssetManager.GetGraphicsAsset("icon") },onPostScoreComplete) local access\_token = event.token end local appID="1234567890" facebook.login(appID, facebookListener, { "publish\_actions, email" } ) end

That’s all that I have for the moment. 

Thanks,

First I don’t see the onPostScoreComplete() function. 

Secondly, you can’t specify a callback function to facebook.request().  It’s going to call facebookListener, the callback you setup in the .login() call.

Third, Facebook requires two logins.  The first login, you do not request any permissions.  This gives you read-only access to the user’s me object.   If you want anything more, like “publish_actions”, you have to make a second call to facebook.login() after successfully logging in.

Fourth, Facebook now requires any app wanting publish_actions or other write permissions to get approval (or use a test app) before it will work.

Fifth, I see you have a print in your facebookListener function, but I don’t see where it’s showing up in the console log you posted (In fact, I don’t see anything that looks like it’s coming from Corona SDK.  You should consider adding more print statements in to see if you’re getting to the places in the code you think you are getting to.  Check some values to make sure they are what you expect, in particular, I’d like to see the access token at the different places.

Rob

Hi,

I don’t know what’s wrong but it is working again. Weird. I’ll get back to this thread if it re-occurs.

Thanks a lot!

Hi,

How should this work?:

Third, Facebook requires two logins.  The first login, you do not request any permissions.  This gives you read-only access to the user’s me object.   If you want anything more, like “publish_actions”, you have to make a second call to facebook.login() after successfully logging in.

Which function will be called by the second Facebook login?..

​So basically after log gin in? I should call login inside my first logins callback function?

Thanks,

-Tristan