Facebook 3.1.1 SDK breaks A LOT

Hum, do you mean that we should just not check for duplicate bugs and just reenter the same bugs over and over again? That sounds kinda strange to me :wink:

And i guess most people (at least i do) first think that they did something wrong (especially with Facebook), reason why you may not have received that many reports.

Anyway, thank you for taking care of this and keeping us informed, looking forward to see that working again.

Dim [import]uid: 100310 topic_id: 34416 reply_id: 140286[/import]

Hi Naomi,

Thank you very much for your hard work here and outlining the different cases you’re come across. I haven’t had time to get back on this but I hope too in the next day or two. It sounds like you confirmed my thoughts that issuing permissions multiple times on the same device is the source of the FB 400 error.

I’m a little confused why you were getting the FB error in your previous post when you only called login once with permissions. You mentioned adding that logout fixed the issue – can you give a little more information where you added that code so I can construct a test case to see what’s going on?

Maybe it would be better to continue the conversation via email and not keep adding to this thread. We can update the thread later when we come to a conclusion about the issue. tom at coronalabs.com

-Tom [import]uid: 7559 topic_id: 34416 reply_id: 140902[/import]

Hi Tom, I’ll follow up with you via email.

Naomi

Edit: Just so I don’t mislead people, I have to add this:
CASE 7 failed, just the same way CASE 5 failed. CASE 7 is equivalent to CASE 5. With CASE 7, only difference from CASE 6 is that the first time user wants to post to FB, he/she needs to login to FB, because he/she skipped on connecting to FB in Scene A. Login call with permission parameter is called only once (just like it does with CASE 5). So I guess facebook.logout isn’t helping. Now what? Dunno what to do. I’ll follow up with Tom and see if he can identify where the problem is and find a fix for it… [import]uid: 67217 topic_id: 34416 reply_id: 140912[/import]

BTW, maybe CASE 6 worked fine every time except that I thought it failed when in fact I was testing CASE 7. The next day, when I tried CASE 6 again, it worked (because perhaps it never failed.)

Anyhow, here’s how CASE 7 went.

CASE 7: Error 400 (app built with1013, installed on a freshly wiped device, with a new user who has not authorized the app on FB)

1 (scene A): facebook.login( myAppID, myFBRegListener, { "ā€œemailā€, ā€œpublish_actionsā€ } )
* User skips on connecting to FB

2 (scene D): facebook.login( myAppID, FBLoginListener, { ā€œemailā€, ā€œpublish_actionsā€ } )
* The user plays a few games and makes a new high score, and decides to post the score on FB
* The app invokes facebook.login( myAppID, FBLoginListener, { ā€œemailā€, ā€œpublish_actionsā€ } )
* Upon successful login to FB, the app invokes facebook.request( ā€œmeā€ )
* Upon successful receipt of the json object with the user data, the app saves the data
* Upon successful save, the app invokes facebook.request(ā€œme/scoresā€ , ā€œPOSTā€, attachment)
* Upon successful post to FB, the app invokes facebook.request(myAppID … ā€œ/scoresā€)
* Upon successful retrieval of score data json object from FB, the app displays the friends scores
* The user then proceed to play another game.

3 (scene D): facebook.login( myAppID, FBScoreListener )
* The user plays a game and beats the previous high score.
* The user chooses to post it to FB and see FB friends score, which invokes facebook.login( myAppID, FBScoreListener )
* Upon successful login to FB, the app invokes facebook.request(ā€œme/scoresā€ , ā€œPOSTā€, attachment)
* Upon successful post to FB, the app tries to invoke facebook.request(appID … ā€œ/scoresā€) but fails with Error: HTTP status code: 400
[import]uid: 67217 topic_id: 34416 reply_id: 140954[/import]

Tom,

Thank you for looking into this issue.

Naomi,

Thanks for the extensive testing scenarios. That is a lot of work and I’m sure it will help find the problems.

Chris [import]uid: 120928 topic_id: 34416 reply_id: 140362[/import]

Thanks for posting the test cases Naomi. That is very helpful.

-Tom [import]uid: 7559 topic_id: 34416 reply_id: 140365[/import]

Here’s the test process I went through. A lot of writing, but I thought I’d go through the code and the test cases to better understand the issue I have. The CASE 3 is the one that caused the Error 400. Is this normal? Is there a way to trap this type of error?

Please note, step 7 of CASE 3 indicates after crashing/killing the app, the FB related code works like a charm.

Not sure if this is of any help, but maybe it would help identify where the problems are?

Also, I really wish I don’t have to call facebook.logout() like I need to. I mean, once logged in, I’d rather not to bring up permission screen and keep asking the user to okay it.

Anyhow, here it goes:


CASE 1: SUCCESS (with a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* FB Connect button brings up FB log in screen
* User enters FB email address and FB password
* FB permission screen with email as part of the app requirement shows up
* User taps on Log in button
* Login process completes without a hitch and automatically triggers facebook.request( ā€œmeā€ ) in step 2

2 (scene A): facebook.request( ā€œmeā€ )
* Fetches login credential perfectly
* Saves login credential for the app
* Completes the scene A

3 (scene B): facebook.login( myAppID, myFBListener )
* This scene has FB Friend button
* Tapping on FB Friend button brings up FB permission screen (stating that the user has already authorized this app)
* User okays it, which automatically triggers the facebook.request( ā€œme/friendsā€ ) in step 4

4 (scene B): facebook.request( ā€œme/friendsā€ )
* Fetches friends list perfectly fine
* Loads the list of friends without a hitch
* Call facebook.logout()
Note: Without calling the facebook.logout() in key spot, moving on to the next step would trigger the ā€œThe operation couldn’t be completed. (com.facebook.sdk error 5.)ā€ At least that’s what I remember happening. So I’ve kept facebook.logout() function in scene B everywhere it seems to need.

5 (scene B): facebook.login( myAppID, myPostListener, { ā€œpublish_actionsā€ } )
* Each FB friend that was fetched in step 4 becomes a friend button
* Tapping on a friend button brings up FB permission screen (stating that the user has already authorized this app)
* User okays it
* automatically triggers facebook.showDialog( ā€œfeedā€, attachment ) in step 6

6 (scene B): facebook.showDialog( ā€œfeedā€, attachment )
* FB dialog pops up
* Tapping on Share button on FB dialog makes the post successfully
* Tapping on another friend’s button brings up FB dialog (without permission screen this time)
* All is good.


CASE 2: SUCCESS (with a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* User skips the FB Connect button

2 (scene B): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* This scene has FB Connect button this time (instead of FB Friend button).
* FB Connect button brings up FB Log in screen
* User enters FB email address and FB password
* FB permission screen with email as part of the app requirement come up
* User taps on Log in button
* Login process completes without a hitch and automatically triggers facebook.request( ā€œmeā€ ) in step 3

3 (scene B): facebook.request( ā€œmeā€ )
* Fetches login credential perfectly
* Call facebook.logout()
* Saves login credential for the app
* Upon successful save, automatically triggers facebook.login( myAppID, myFBListener ) in step 4

4 (scene B): facebook.login( myAppID, myFBListener )
* Immediately after the login process completes, FB permission screen comes up (stating that the user has already authorized this app)
* User okays it, which triggers facebook.request( ā€œme/friendsā€ ) in step 5

5 (scene B): facebook.request( ā€œme/friendsā€ )
* Fetches friends list perfectly fine.
* Loads the list of friends without a hitch
* Call facebook.logout()

6 (scene B): facebook.login( myAppID, myPostListener, { ā€œpublish_actionsā€ } )
* Each FB friend that was fetched in step 5 becomes a friend button
* Tapping on a friend button brings up FB permission screen again (stating that the user has already authorized this app)
* User okays it, which automatically triggers facebook.showDialog( ā€œfeedā€, attachment ) in step 7

7 (scene B): facebook.showDialog( ā€œfeedā€, attachment )
* FB dialog pops up
* Tapping on Share button on FB dialog makes the post successfully
* Tapping on another friend’s button brings up FB dialog (without permission screen this time)
* All is good.


CASE 3: FAIL (with a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* User skips FB Connect button

2 (scene B): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* This scene has FB Connect button this time (instead of FB Friend button).
* FB Connect button brings up FB Log in screen
* User enters FB email address and FB password
* User closes the FB Log in screen (canceling the process)

* User is sent back to the scene with FB Connect button
* User taps on FB Connect button, which brings up FB Log in screen
* User enters FB email address and FB password and proceed to log in
* FB permission screen with email as part of the app requirement come up
* User closes the FB permission screen without tapping on Login button (canceling the process)

* User is sent back to the scene with FB Connect button
* User taps on FB Connect button again
* This time, user chooses to go through FB login process, which automatically triggers facebook.request( ā€œmeā€ ) in step 3

3 (scene B): facebook.request( ā€œmeā€ )
* Fetches login credential perfectly
* Call facebook.logout()
* Saves login credential for the app
* Upon successful save, automatically triggers facebook.login( myAppID, myFBListener ) in step 4

4 (scene B): facebook.login( myAppID, myFBListener )
* FB permission screen comes up (stating that the user has already authorized this app)
* User okays it, which triggers facebook.request( ā€œme/friendsā€ ) in step 5

5 (scene B): facebook.request( ā€œme/friendsā€ )
* FB permission screen comes up (stating that the user has already authorized this app)
* User closes the screen without tapping on okay
* It sends the user back to scene B with FB Connect button

6 (scene B): facebook.login( myAppID, myFBListener )
* User taps on FB Connect button again, which brings up FB permission screen again (stating that the user has already authorized this app)
* User taps on okay to the FB permission screen
* App crashes with Error: HTTP status code: 400

After restarting the app, I come back to Scene B straight away.
7 (Scene B): facebook.login( myAppID, myFBListener )
* This scene has FB Friend button this time (instead of FB Connect button). ( Edit: copy & paste caused mis-information. Here, the button now shows FB Friend. I’ve corrected it.)
* Tapping on FB Friend button appears to automatically okay FB permission and fetch FB friends list, which is equivalent to reaching the step 6 of case 2 without any interruption as far as the user experience is concerned. (And this is the type of user experience I’d like to offer after the user logs in to FB and authorizes the app just once.) [import]uid: 67217 topic_id: 34416 reply_id: 140299[/import]

Glad to hear it’s helpful. I’ve corrected some mis-information caused by copying & pasting the steps.

Naomi [import]uid: 67217 topic_id: 34416 reply_id: 140367[/import]

Naomi, is the failing sequence something that just started (e.g, with build 991) or is it there in the current release build (971)? We upgraded Corona to the latest Facebook SDK (3.1.4) in build 991 and trying to sort out if we have a regression problem or not.

Thanks,
Tom [import]uid: 7559 topic_id: 34416 reply_id: 140369[/import]

Tom, read the whole thread; Works in 990, breaks in 991. :slight_smile: [import]uid: 21746 topic_id: 34416 reply_id: 140370[/import]

I was asking about Naomi’s thread. I didn’t see any build numbers mention. [import]uid: 7559 topic_id: 34416 reply_id: 140373[/import]

Hey, Tom, my current project throws out bazillions of errors when I try using older daily build. Let me see if I can reproduce error like this with my previous game that was built with 894. Either way, it involves a bit of work to get the test environment set up. (The last time I worked on Beetle Bounce, it was set up for Android version. Changing it back to iOS with debug statements enabled, plus wiping the device for new user, etc… will take a bit of time – and I’m not even sure if the game itself is set up to go through the same path for the CASE 3 procedure…) Anyhow, I’ll report back…

Naomi

Edit: BTW, my test cases were done with daily build 1008. While setting up the device and test environment, I’ll fetch 991. I will first test Beetle Bounce with 894. If it doesn’t help with the test properly, I’ll see if my current project runs on 991.

Edit 2: Okay, how stupid (I’m calling myself stupid here, by the way.) While I set up BB for the test and built it, 991 downloaded fast enough, and my current project runs fine. I’ll go through all 3 test cases and report back. [import]uid: 67217 topic_id: 34416 reply_id: 140377[/import]

Thanks for all the work Naomi. I did confirm I get Error 5 (status 400) from the Facebook sample app and found this is a common issue with Facebook 3.0 SDK. It looks like there are a couple things that can cause this error. The first caused by sending the same message/photo multiple times. Facebook thinks this is spam and returns an error. The other issue is when you try to post when the session is closed. I need to see if this is what’s happening in your failed case.

You can read more about the issue here: http://www.abdus.me/ios-programming-tips/com-facebook-sdk-error-5-irritating-isnt-it/

I haven’t confirmed it yet but it could be the new Facebook SDK has added more safeguards and we are violating that in some way.

BTW, HTTP 400 is ā€œBad Requestā€ so that makes sense in terms of what I found.

-Tom
[import]uid: 7559 topic_id: 34416 reply_id: 140381[/import]

If you are using the Facebook sample code and you get the Facebook error 5, it will crash the app because of a Lua error (shows up as a Pcall error in the console). The reason is the event.response is treated as a json table when it’s actually an error string. Here is a code snippet that fixes the problem:

[code]
else
– Post Failed
statusMessage.textObject.text = ā€œPost failedā€

– Added **1/25/2013
if type( event.response ) == ā€œstringā€ then
print( "Error message: " … event.response )
else
printTable( event.response, ā€œPost Failed Responseā€, 3 )
end
end
[/code] [import]uid: 7559 topic_id: 34416 reply_id: 140382[/import]

@Tom: @haakon is right. The dreaded com.facebook.sdk error 5 occurs if you give the {"publish\_stream"} argument for "me" and "me/friends" requests. Solution:

[lua]if fbCommand == ā€œfeedā€ then
facebook.login(fbID, fbListener, {ā€œpublish_streamā€})
else
facebook.login(fbID, fbListener)
end[/lua]

[import]uid: 73434 topic_id: 34416 reply_id: 140387[/import]

WAIT. OMG, I made a few changes to my script, went back to daily build 1008, and I can no longer reproduce the error 400. What the… Lemme build it for 991 and I’ll report back with the result.

Edit: OMG, I spoke too soon. I can still get Error: HTTP status code: 400 with build 1008 after all (and it’s probably the same with 991 – just took a while to thoroughly test this with my app.) How to reproduce it has something to do with how I cancel the FB process. I’ve used three different ways to cancel the process:

  1. There’s this ā€œcancelā€ button on the FB permission/login screen to cancel it.

  2. The second method is just closing the browser window by simply returning to the devices home screen by tapping on the device’s home button (the one with the square icon at the bottom of the device) and relaunching the app.

  3. The third method to cancel the process is by simply closing the FB permission/login screen by tapping on the browser’s double square icon (which shows what web pages are open), x’ing out all browser windows, then pressing the device’s home button, and then relaunching the app.

I’m a bit too tired to methodically check every possible combination of which cancellation method would trigger the error 400. I’ve done some combination of these methods without really paying much attention. All I can say at this point is, maybe this is too much of an edge case to even worry about. If a user really wants to mess with the app, what can the app do about it…?

Other than this, I’d say with all of the error trapping procedures I implemented to my script, the latest Facebook implementation is working fine. Sigh. Sorry about all the noise I’ve made.

Now I’m moving on to implement Facebook score API.

Naomi


Here’s my finding after going through the 3 test cases. I don’t know if it’s relevant or helpful at this point. All I can tell is, there’s definitely changes in how errors are handled with the updated Facebook SDK.

Please note, I have not commented out multiple facebook.logout that I needed to use with the daily build 1008. I don’t know how it would behave with daily build 991 if I remove what appears to be quite unnecessary facebook.logout calls that I needed to add for daily build 1008.

Please also note, I have not tested how it goes with posting on friend’s wall without using facebook.showDialog call. Meaning, I have not tested the following method with the daily build 991:
facebook.login( myAppID, myPostListener, { ā€œpublish_actionsā€ } )
facebook.request( feedMyFriend, ā€œPOSTā€, attachment )

As I noted on my post #20 above, POST method causes Error: HTTP status code: 403 when I tried it with daily build 1008. (It might still be the case even with daily build 991, especially if this error is caused by Facebook no longer permitting this method.)

Anyhow, here’s the result:

CASE 1: SUCCESS (works just like the daily build 1008)

CASE 2: SUCESS (works just like the daily build 1008)

CASE 3: STRANGE FAILURE
EDIT: I’m editing this out. I’ve added some error trapping scripts, and it wouldn’t fail like previously described. [import]uid: 67217 topic_id: 34416 reply_id: 140390[/import]

@olav.morkrid, I don’t think it hurts to submit a bug report. About Apple, I doubt it will reject your apps because of this particular leak you found (unless your app accumulates this leak very quickly for some reason.) How often & how quickly do you add the 64 bytes to the memory during the time the user uses your app? If it adds up very rapidly and ends up crashing the app every time you run your app, then it would be a no go (meaning, Apple won’t approve it.) But if it takes hours and months of uninterrupted use of your app, then Apple probably won’t notice.

@Tom, here’s the update to my saga. I was able to sort out the user flow by removing facebook.logout entirely and calling facebook.login only once at the time of entry to the Scene C with rows & rows of FB friends (which the user enters from Scene B with FB Connect/Friends button. And sorry about changing the scene names – I felt I needed to introduce scene C to make my test case easier to understand.)

Anyhow, thanks to your detailed post on #47, I decided the evil is with using facebook.login for the multiple of facebook.request the app makes in a quick succession where the likelihood of user signing out in-between is almost nil. Taking this measure solved the CASE 2 & CASE 4 issue completely. It flows perfectly well, just like how I wanted to have it. With this fix, the user experience is very much the same as the successful user experience achieved with the CASE 4 using daily build 990.

THAT SAID… I don’t know how I may work around the last bit of problem. I still get Error Status 400 under the following scenario. Can you think of any reason why it’s still giving out this error? Is this a Corona bug, or is this a Facebook bug, or am I doing something wrong?

CASE 5: Error 400 (app built with1013, installed on a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBRegListener, { "ā€œemailā€, ā€œpublish_actionsā€ } )
* User skips the FB Connect button

2 (scene B): go to scene C
* Because the user has not supplied FB credentials, this scene displays FB Connect button
* Tapping on the FB Connect button transitions the scene to C (using storyboard API)

3 (scene C): facebook.login( myAppID, myFBLoginListener, { ā€œemailā€, ā€œpublish_actionsā€ } )
* Upon entering this scene, facebook.login( myAppID, myFBLoginListener, { ā€œemailā€, ā€œpublish_actionsā€ } ) is invoked.
* Upon successful login, facebook.request( ā€œmeā€ ) is invoked
* Upon successful receipt of the json object with the user data, the app saves the data
* Upon successful save, facebook.request( ā€œme/friendsā€ ) is invoked
* Upon fetching the friends list, the scene C successfully displays the friends list

4 (scene C): facebook.login( myAppID, FBPostListener )
* User taps on a friend
* If the friend is already registered with the app, the app initiates a match game between the players
* If the friend is not already registered with the app, facebook.login( myAppID, FBPostListener ) is invoked
* Upon successful login, facebook.showDialog( ā€œfeedā€, attachment ) is invoked

5 (scene C): facebook.showDialog( ā€œfeedā€, attachment )
* This brings up the FB dialog without a problem
* The user taps on Share button, and it posts on the friends wall.
* The user now exits scene C and returns to scene B

6 (scene B): go to scene C
* Now that the app has the user’s FB credential, the button changes from FB Connect to FB Friend
* Tapping on the FB Friend button sends the user to scene C again

7 (scene C): facebook.login( myAppID, myFBListener )
* Now that the app has the user’s FB credential, entering the scene invokes facebook.login( myAppID, myFBListener ) instead of facebook.login( myAppID, myFBLoginListener, { ā€œemailā€, ā€œpublish_actionsā€ } )
* Then the dreadful Error: HTTP status code: 400 shows up.
* User sees a message from the app stating that it could not log in to Facebook.
* Tapping on the message sends the user back to scene B.

8 (scene B & C)
* This turns into never ending loop – i.e., step 6 and step 7 can repeat over and over
* At this point, the user kills the app by tapping on home button, then double tapping on home button, and then closing the app.

9 (scene B) go to scene C
* After the app is restarted, the user goes straight to Scene B
* The app remembers the user’s FB credential and displays FB Friend button
* Tapping on the FB Friend button sends the user to scene C

10 (scene C): facebook.login( myAppID, myFBListener )
* Upon entering the scene, facebook.login( myAppID, myFBListener ) is invoked (just like step 7 above)
* Upon successful login, the listener invokes facebook.request( ā€œme/friendsā€ )
* Upon fetching the friends list, the scene C successfully displays the friends list

After this, moving between scenes B & C causes no error.

How do you think this problem can be solved?

I’m not sure if this means anything, but I also noticed something odd. ( Edit: Could this be related to the phantom Session Bug that haakon mentions in post #3…? ) After I had the never ending loop in step 8, I left the device idle for a while without killing it (mainly because I was writing up this post). And then before killing the app, I tapped on Friend button once again. It brought up FB permission screen. I don’t know why I didn’t tap on Okay for the permission request, but I didn’t. I just killed the app right there and then, which brought me to step 9. Anyhow, it still makes very little sense why Error 400 occurs. I just hope you can identify the issue here, because I can’t think of any work around that makes sense.

Naomi

Saga continues… This is getting really long, but here’s another case where it manifests exactly the same problem. I believe the issue is clear enough at this point, and I’d very much like to hear what you suggest I do with Facebook feature. It really isn’t going to work for me the way it behaves. (Unless, I suppose, I bring back that awkward facebook.logout calls or revert back to daily build 990.)


EDIT: CASE 6 actually works perfectly fine. It appears that I was testing some other path, thinking it was this particular path I was taking. Please see my update in post #55.

CASE 6: Error 400 (app built with1013, installed on a freshly wiped device)

1 (scene A): facebook.login( myAppID, myFBRegListener, { "ā€œemailā€, ā€œpublish_actionsā€ } )
* User taps on the FB Connect button, which invokes facebook.login( myAppID, myFBRegListener, { "ā€œemailā€, ā€œpublish_actionsā€ } )
* Upon successful login, facebook.request( ā€œmeā€ ) is invoked
* Upon successful receipt of the json object with the user data, the app saves the data and go to next scene (using storyboard API)

2 (scene D): facebook.login( myAppID, FBScoreListener )
* The user plays a few games and reaches a new high score.
* The user has a choice to post his/her score and see FB friends scores
* The user chooses to do so, and the app invokes facebook.login( myAppID, FBScoreListener )
* Upon successful login to FB, the app invokes facebook.request(ā€œme/scoresā€ , ā€œPOSTā€, attachment)
* Upon successful post to FB, the app invokes facebook.request(myAppID … ā€œ/scoresā€)
* Upon successful retrieval of score data json object from FB, the app displays the friends scores
* The user then proceed to play another game.

3 (scene D): facebook.login( myAppID, FBScoreListener )
* The user plays a game and beats the previous high score.
* The user chooses to post it to FB and see FB friends score, which invokes facebook.login( myAppID, FBScoreListener )
* Upon successful login to FB, the app invokes facebook.request(ā€œme/scoresā€ , ā€œPOSTā€, attachment)
* Upon successful post to FB, the app tries to invoke facebook.request(appID … ā€œ/scoresā€) but fails with Error: HTTP status code: 400

From then onward, the app performs all non-FB related tasks, but it returns Error 400 for anything FB. Accessing Friends List in Scene C fails with Error 400 as well.

However, once I kill and restart the app, everything normalizes, and posting high scores one game after the other no longer fails. Friends List in Scene C can also be accessed and used as expected.

There is a bug somewhere, but at this point, I’m pretty sure the bug is caused either by the updated Facebook SDK or by how Corona integrated it. [import]uid: 67217 topic_id: 34416 reply_id: 140589[/import]

Isn’t 990 the last build with the older Facebook SDK. I thought the problems started with 991. [import]uid: 199310 topic_id: 34416 reply_id: 140425[/import]

I hate to add more to this saga, but I can’t help myself. I had to test what would happen if I didn’t call facebook.logout() after calling facebook.login( myAppID, myFBListener, { ā€œemailā€ } ) to fetch the user login credential – on both build 991 and 1008.

The result was identical. It surprised me. I thought the issue was introduced when FB SDK was updated, but it looks like that was not the root cause of the issue.


Edit: I was testing on wrong build. I needed to test on 990 and 1008 to see the difference. And the result was not identical. It was different like night and day. The case 4 result detailed below is with 1008 which incorporated updated FB SDK. My post #46 shows the case 4 result with 990 that uses un-updated FB SDK.

I followed the CASE 2 procedure – meaning, I did not intentionally cancel the login process because I really wanted the FB login process to work:

CASE 4: (modified version of CASE 2 with a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* User skips the FB Connect button

2 (scene B): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* This scene has FB Connect button this time (instead of FB Friend button).
* FB Connect button brings up FB Log in screen
* User enters FB email address and FB password
* FB permission screen with email as part of the app requirement come up
* User taps on Log in button
* Login process completes without a hitch and automatically triggers facebook.request( ā€œmeā€ ) in step 3

3 (scene B): facebook.request( ā€œmeā€ )
* Fetches login credential perfectly
* Do not call facebook.logout() here – I commented it out from the script
* Saves login credential for the app
* Upon successful save, automatically triggers facebook.login( myAppID, myFBListener ) in step 4

4 (scene B): facebook.login( myAppID, myFBListener )
* Immediately after the login process completes, FB permission screen comes up (stating that the user has already authorized this app)
* User okays it
* Then the screen goes back to my app, while I also get Error: HTTP status code: 400
* My app screen says Facebook login failed.
* User closes the login fail notice.

5 (scene B): facebook.login( myAppID, myFBListener )
* The screen updates to show FB Friends button.
* Tapping on it launches facebook.login( myAppID, myFBListener )
* Which brings up FB permission screen again (stating that the user has already authorized this app)
* Tapping okay triggers Error: HTTP status code: 400 again.
* My app screen says Facebook login failed.
* User closes the login fail notice.
* And this step 5 repeats itself over and over.
* All the other parts of the app appears to behave and function as expected. I just can’t go anywhere beyond this step 5 with FB feature of the app.
* So I killed the app and relaunched it.

6 (scene B) – tapping on FB Friends button brings up friends list (the buttons) without asking for FB permission, and it works smoothly without a hitch.

So it appears, adding the facebook.logout() was absolutely necessary to avoid the error 400. I think it was haakon who identified and posted the need to add facebook.logout() in some other thread somewhere – thank you (and if it was someone else, whoever it was, thank you.) It was frustrating process, but this really got me trapping all sorts of potential errors that could crash my app.

Also, you wouldn’t encounter this issue if you don’t need the login to require email as part of the parameter (and if so, you may not need to call facebook.logout). In my app, under this specific path user takes, it is necessary.

Anyhow, I hope this test result helps others who come across the same error.

Naomi
[import]uid: 67217 topic_id: 34416 reply_id: 140422[/import]

OMG, Rob, thanks for pointing that out. How terrible. I totally misread the earlier post. Should not have downloaded the 991 at all. Urrrrrrgh. This is turning into a nightmare. I’ll download 990. I guess I have to go through this whole bloody test process again (if I am to follow through with this pain-in-the-neck test procedure.)

Edit: OMG, pardon my language above. I was so exasperated that I couldn’t help myself.

Lo and behold. 990 DID NOT THROW ANY ERRORS! And it worked soooo smoothly that I can cry.

So, it was the Facebook SDK upgrade that caused this issue after all. And with the 990, I don’t need to call facebook.logout at all. I hope Corona Labs can implement the fix.

Anyhow, please see my test case below.

Naomi

CASE 4: (app built with 990, test process is the modified version of CASE 2 with a freshly wiped device with a new user)

1 (scene A): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* User skips the FB Connect button

2 (scene B): facebook.login( myAppID, myFBListener, { ā€œemailā€ } )
* This scene has FB Connect button this time (instead of FB Friend button).
* FB Connect button brings up FB Log in screen
* User enters FB email address and FB password
* FB permission screen with email as part of the app requirement come up
* User taps on Log in button
* Login process completes without a hitch and automatically triggers facebook.request( ā€œmeā€ ) in step 3

3 (scene B): facebook.request( ā€œmeā€ )
* Fetches login credential perfectly
* Do not call facebook.logout() here – I commented it out from the script
* Saves login credential for the app
* Upon successful save, automatically triggers facebook.login( myAppID, myFBListener ) in step 4

4 (scene B): facebook.login( myAppID, myFBListener )
* Behind the scene, it calls facebook.login( myAppID, myFBListener ), which triggers facebook.request( ā€œme/friendsā€ ) in step 5

5 (scene B): facebook.request( ā€œme/friendsā€ )
* Fetches friends list perfectly fine.
* Loads the list of friends without a hitch.
* Do not call facebook.logout() here – I commented it out from the script

  1. (scene B): facebook.login( myAppID, myPostListener, { ā€œpublish_actionsā€ } )
    * Each FB friend that was fetched in step 5 becomes a friend button
    * If the friend is not already registered with the app, tapping on the friend’s button triggers facebook.showDialog( ā€œfeedā€, attachment ) in step 7

7 (scene B): facebook.showDialog( ā€œfeedā€, attachment )
* FB dialog pops up
* Tapping on Share button on FB dialog makes the post successfully
* Tapping on another friend’s button brings up FB dialog (without permission screen this time)
* ALL WORKS EXTREMELY WELL.

THE USER HAD TO AUTHORIZE THE APP ONLY ONCE! PERFECT.

P.S. Just to be clear, as far as the user is concerned, all he/she sees is the initial FB login screen. Once the user logs in, the next thing he/she sees is the app screen with rows of friends’ names. If a friend is already registered with the app, tapping on the friend initiates a match game for this app. If a friend is not already registered, tapping on the friend brings up the FB dialog (without pausing to ask for the user’s FB permission.) Works really like a charm when built with 990.
[import]uid: 67217 topic_id: 34416 reply_id: 140430[/import]