Facebook log in on iOS opening Facebook home page.

Hello.

When I try to log in to Facebook with the Facebook API on iOS (on android it works perfectly) the API window pops up, but not on the log in page, but on Facebook homepage, if I click the home button, the API window closes, and if I then try again to log in, it shows the correct log in page.

Is this a knows issue? this has started showing up a couple of weeks ago, and was still present in the last Corona build I’ve downloaded and installed.

Thanks.

Yuval.

Can you post your build.settings file please? 

What version of Corona SDK are you running?

Are there any errors in your console log?

Do you have the facebook native app installed?

Also having this issue sometimes. Version 1170.

Facebook is a hot mess right now. Had it working on IOS and was working to get it running on Android, now both systems are acting very random.  Sometimes IOS connects and posts, other times it doesn’t.  I’m just ripping facebook out of my app for now until the mess is sorted.

Yeah, wish I could do the same, but my boss is pretty set to have the Facebook connectivity in our app… not only do I need to deliver as a one man developing/QA team, I need to deliver exactly what my boss wants.

Rob, I’m sorry I didn’t get to it yet, I’ll post here the information you requested on Monday morning (my local time, Rome, Italy).

I am done cursing at Facebook as well. My button from the examples is not even firing at this point. Going to release an update with it not in the app since it isn’t working…

@mattchapman when you say “My button from the examples” what do you mean?  Also what do you mean by it’s not firing? 

This is the button that won’t fire at all now…

Running the lastest build… this is changed after it did nothing using the origical Jonathan Beebe code…

local function shareScore() if event.phase == "pressed" then print("yup it is pressing") local fbAppID = "403211566467035" --\> (string) Your FB App ID from facebook developer's panel local facebookListener = function( event ) if ( "session" == event.type ) then facebook.logout() facebook.login( fbAppID, facebookListener, { "publish\_stream" } ) -- upon successful login, update their status if ( "login" == event.phase ) then local statusUpdate = "just scored a " .. currentHighScore .. " on Coin Adventure!" facebook.request( "me/feed", "POST", { message=statusUpdate, name="Download Coin Adventure and beat my score!", caption="Coin Adventure - Available for iOS, Android, Kindle and Nook", link="https://itunes.com/apps/coinadventure", picture="http://www.origintech.net/coinadventure.png" } ) end end end facebook.login( fbAppID, facebookListener ) return true end end

I’m assuming you’re getting “Yup it’s pressing”?

Is there a reason you’re not requesting publish_stream on the initial login?  That is not one of the permissions that requires a second request as far as I can tell and you don’t need any extended permissions to post on your own timeline.  If that’s all your doing, you shouldn’t need any of the secondary login bits.

So Rob… after putting it back in the login and and removing it from the first part… I can now get it to leave the app have facebook ask for permissions twice… both of which I say yes to then it whites out and returns to the app without posting anything… try touching the same button and it does nothing… look on wall and nothing is there.

Thoughts?

Can you post your current code?

Matt, I noticed what looks like some logic errors in your code.  After logging in the first time with just basic permissions, you then logout and login again to request a publishing permission.  That part is, in concept, OK, since it’s required by Facebook to have basic permissions before requesting an extended permission.  But I think there are some problems with how you’ve implemented it:

  • After the first login succeeds, your code not only logs outs and attempts to login again, it also continues and attempts to post to Facebook.  That will fail, since at the time, you don’t yet have the publishing permission

  • After the first login succeeds, and you logout and attempt to login again, the listener you pass to this second call to facebook.login() is facebookListener.  However, that value will, at the time be nil, since it’s a reference to the function in which it’s occurring, and the function wasn’t predeclared.  Since it’s nil, your listener won’t fire in response to the second login, and so the post will not be attempted.  To call a function within itself, you have to predeclare it.  As a simple example, compare the output of the following two snippets (the only difference is that, in the second one, myFunction is predeclared):

[lua]

local myFunction = function()

   print(myFunction)

end

myFunction()       – Will print nil

[/lua]

[lua]

local myFunction

myFunction = function()

   print(myFunction)

end

myFunction()       – Will print a reference to the function

[/lua]

  • Andrew
Rob.. here is the code that actually now gets to setting the permission and then exiting back to the app... the share score button then doesn't do anything after that first run which establishes the permission with Facebook. As you can see I changed the position of the listener back to where the examples show it to be.. Andrew I get what you are saying and thanks.. I had moved that around based on a suggestion from another person having facebook issues (the login, logout, login again thing). local function shareScore() print("yup it is pressing") local fbAppID = "403211566467035" local facebookListener = function( event ) if ( "session" == event.type ) then if ( "login" == event.phase ) then local statusUpdate = "just scored a " .. currentHighScore .. " on Coin Adventure!" facebook.request( "me/feed", "POST", { message=statusUpdate, name="Download Coin Adventure and beat my score!", caption="Coin Adventure - Available for iOS, Android, Kindle and Nook", link="https://itunes.com/apps/coinadventure", picture="http://www.origintech.net/coinadventure.png" } ) end end end facebook.login( fbAppID, facebookListener, {"publish\_stream"} ) return true end

YES!.. I changed the …currentHighScore to the actual to string(highScore) and all of a sudden I have a working post… still doesn’t show me what I thought like actually pausing… it shows it on your wall just fine though.  It was how I was declaring the global currentHighScore outside the functions earlier that since it was not reading was breaking the message and stopping the whole dang post.

Rob… thanks for the sanity check on the other stuff related to facebook it was very helpful in starting this.  Ironically I figured this out because the post to Twitter using native.showPopup is so easy that it threw the global nil error for me and that made me see the issue with posting to facebook.

Can you post your build.settings file please? 

What version of Corona SDK are you running?

Are there any errors in your console log?

Do you have the facebook native app installed?

Also having this issue sometimes. Version 1170.

Facebook is a hot mess right now. Had it working on IOS and was working to get it running on Android, now both systems are acting very random.  Sometimes IOS connects and posts, other times it doesn’t.  I’m just ripping facebook out of my app for now until the mess is sorted.

Yeah, wish I could do the same, but my boss is pretty set to have the Facebook connectivity in our app… not only do I need to deliver as a one man developing/QA team, I need to deliver exactly what my boss wants.

Rob, I’m sorry I didn’t get to it yet, I’ll post here the information you requested on Monday morning (my local time, Rome, Italy).

I am done cursing at Facebook as well. My button from the examples is not even firing at this point. Going to release an update with it not in the app since it isn’t working…

@mattchapman when you say “My button from the examples” what do you mean?  Also what do you mean by it’s not firing? 

This is the button that won’t fire at all now…

Running the lastest build… this is changed after it did nothing using the origical Jonathan Beebe code…

local function shareScore() if event.phase == "pressed" then print("yup it is pressing") local fbAppID = "403211566467035" --\> (string) Your FB App ID from facebook developer's panel local facebookListener = function( event ) if ( "session" == event.type ) then facebook.logout() facebook.login( fbAppID, facebookListener, { "publish\_stream" } ) -- upon successful login, update their status if ( "login" == event.phase ) then local statusUpdate = "just scored a " .. currentHighScore .. " on Coin Adventure!" facebook.request( "me/feed", "POST", { message=statusUpdate, name="Download Coin Adventure and beat my score!", caption="Coin Adventure - Available for iOS, Android, Kindle and Nook", link="https://itunes.com/apps/coinadventure", picture="http://www.origintech.net/coinadventure.png" } ) end end end facebook.login( fbAppID, facebookListener ) return true end end

I’m assuming you’re getting “Yup it’s pressing”?

Is there a reason you’re not requesting publish_stream on the initial login?  That is not one of the permissions that requires a second request as far as I can tell and you don’t need any extended permissions to post on your own timeline.  If that’s all your doing, you shouldn’t need any of the secondary login bits.