Facebook 3.1.1 SDK breaks A LOT

After more testing, it just plain won’t log me in at all - even with permissions changed to “publish_actions” as well as with permissions removed from the login() call.

Anyone experiencing this with the latest build? [import]uid: 131038 topic_id: 34416 reply_id: 137210[/import]

Bug submitted. [import]uid: 131038 topic_id: 34416 reply_id: 137211[/import]

I also had the same problem with the latest build, couldn’t login or upload a picture anymore. But it actually worked on the iOS simulator, but not on the device. Then I removed the permissions and re-installed the Facebook App on my device and it worked again. But thats’s only tested on my device. [import]uid: 98060 topic_id: 34416 reply_id: 137213[/import]

Hi, we have tested for several days now with a stable Facebook implementation. The key to solve the bug was to remove permissions from facebook requests that are GET. For example:

facebook.request(“me”)
facebook.request(“me”, “GET”, {fields=“id,username,name”})

and

facebook.request(“me/friends”)
facebook.request(“me/friends”, “GET”, {fields = “id, name, installed”})

I can see why Facebook has done this change. We always asked publish_actions on all facebook logins to be able to post achievements to the user’s wall from our servers. Now we’re not getting that permission before the user has chosen to post something from the app.

I still think there’s a Corona bug here, though. The Facebook SDK must have thrown an error when we tried to request publishing permissions when the user did a GET operation, but the error did not become visible to us before the user did the next operation. [import]uid: 21746 topic_id: 34416 reply_id: 138323[/import]

Hi, we have tested for several days now with a stable Facebook implementation. The key to solve the bug was to remove permissions from facebook requests that are GET. For example:

facebook.request(“me”)
facebook.request(“me”, “GET”, {fields=“id,username,name”})

and

facebook.request(“me/friends”)
facebook.request(“me/friends”, “GET”, {fields = “id, name, installed”})

I can see why Facebook has done this change. We always asked publish_actions on all facebook logins to be able to post achievements to the user’s wall from our servers. Now we’re not getting that permission before the user has chosen to post something from the app.

I still think there’s a Corona bug here, though. The Facebook SDK must have thrown an error when we tried to request publishing permissions when the user did a GET operation, but the error did not become visible to us before the user did the next operation. [import]uid: 21746 topic_id: 34416 reply_id: 138323[/import]

"The operation couldn’t be completed. (com.facebook.sdk error 5.)"

I’m also getting this error (using daily build 1006). The code used to work. I believe the updated Facebook SDK integration caused this error to appear. In my case, the facebook.login( myAppID, myFBListener, {“publish_action”} ) seems to work just fine.

It breaks when I do the facebook.request( “me/friends” ) to pull down FB friends list. Immediately after facebook.request( “me/friends” ) is called, the console log shows:

didComplete: false  
Error: HTTP status code: 400  
event.name = fbconnect  
event.type = request  
isError = true  
didComplete = false  
RESPONSE: The operation couldn’t be completed. (com.facebook.sdk error 5.)  
  
-- then it continues on with the following  
event.name = fbconnect  
event.type = session  
isError = false  
didComplete = nil  
FBConditionalLog: handleOpenURL should not be called once a session has closed  

Is there a workaround for this?

@haakon, I’m not sure how I may apply your finding to my case.

@borderleap, have you heard from CoronaLabs regarding the bug you reported? Should I create and submit some test case too?

There’s nothing very complex about my setting. It simply breaks when I try to pull down user’s friends’ name and FB ID. The code used to work just fine…

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

Naomi, you need to concider what you are doing after the login phase. If you are doing a GET operation after the login phase, like get “/me” or get “/me/friends”, then your login phase must be done without requesting any publishing permissions (publish_stream, publish_actions etc).

When “/me” or “/me/frieds”:
NO: facebook.login( myAppID, myFBListener, {“publish_action”} )
YES: facebook.login( myAppID, myFBListener)

Hope that makes sense. If you find something not working after logging in with publishing permissions, just remove the permissions from the login call. [import]uid: 21746 topic_id: 34416 reply_id: 139623[/import]

Ah, of course. @haakon, thank you so much for clarifying it. After reading your reply post #15, I re-read your post #13 above, and it clicked. (I can’t believe I didn’t get it the first time around, especially since you did include facebook.request(“me/friends”) in the GET list. Yikes, I was blind.)

Thanks again!!

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

Hi All,

Thanks for this thread, it’s stopped me going mad debugging this issue. I have one stupid question if I may? How do I now get the publish permission when I need it? Do I just re-login or is there a better way?

Eg
1: Login (without publish)
2: Get friends etc
3: ??? (something to get the appropriate permission)
4: Post to users wall

I am trying to call the login function again (with the added permissions) - but all it does is open FB for a few seconds, returns to my app and fails. It doesn’t prompt the user to grant the additional permissions.

Thanks

Antony

[import]uid: 169392 topic_id: 34416 reply_id: 139670[/import]

Hey, Antony, I updated my FB implementation as per haakon’s note, and it works fine for me:

  1. When I just log my user in to FB, I do this, and this seems to work fine. Even though I’m pulling down the user’s FB data in the process, it didn’t cause any error. I wonder why. Maybe I should test this again just in case:
    facebook.login( myAppID, myFBListener, { “email” } )

Edit: I did a fresh install (after wiping my device), and it turns out that simply logging into FB with permission works fine. However, if I proceed to step 2 below (pulling down the FB friends list), it fails. If I login with permission first, and then call facebook.logout() before proceeding to step 2, it works fine. So, it seems like the options I have is to either log user out immediately after I log them in with permission, or not require permission at all when user connects with FB during the registration process…

  1. When I need to pull down FB friends list, I do this, and it works like a charm:
    facebook.login( myAppID, myFBListener)

  2. When I need to POST a message on FB wall, I do this, and it works like a charm:
    facebook.login( myAppID, myFBListener, {“publish_action”})

  3. By the way, I was also able to POST a message even when I removed the permission (but I decided to keep the permission for my app):
    facebook.login( myAppID, myFBListener)

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

Hi Naomi,

This page was quite helpful
https://developers.facebook.com/docs/howtos/login/handling-revoked-permissions/
They basically say, only ask for permissions as as you need them - and hint you need to go through the relogin process.

So in my testing I did this (although I am using Bob Dickinson’s FB helper - so my calls are slightly different)

1: facebook.login( myAppID, myFBListener, { “email” } )
2: Get friends - Works fine
3: facebook.login( myAppID, myFBListener, { “publish_action” } )
4: post to users wall

Step 3 failed for me, as it never actually prompted the user to authorise the new permission (yes I had cleared the authorisation in FB) and so step 4 failed with an error.

Maybe you do need to logout and in again as you have suggested - but to be honest I really wanted to get the next update to my app out so I reverted back to build 990, submitted the app version and decided to re-look at this issue when I need to do the next update!

Antony [import]uid: 169392 topic_id: 34416 reply_id: 139823[/import]

Hey, Antony, after I wiped my device and clean slated FB test user account, I’m getting the similar result as yours.

It was working fine (as I described in post #18) yesterday. But today, after I clean slated my test device and FB test user account, posting to user’s friend’s wall completely fails with Error: HTTP status code: 403

1: facebook.login( myAppID, myFBListener, { “email” } ) - works fine
2: facebook.request( “me/friends” ) - works fine (and fetches friends list)
3: facebook.login( myAppID, myPostListener, { “publish_actions” } ) - logs in fine
4: facebook.request( feedMyFriend, “POST”, attachment ) - fails with HTTP error

The code for step 4 used to work (it worked yesterday), but now it doesn’t. Ugh.

Naomi

Edit 1: I went back and looked up FB Graph API:
https://developers.facebook.com/docs/reference/api/publishing/
Regarding the /PROFILE_ID/feed method (for publishing a new post on the given profile’s feed/wall), it says Note that this feature will be removed soon.

Yikes, maybe that’s why it’s not working anymore. Urrrrrgh. How frustrating.

Edit 2: Here’s a relevant post by @george18 (thank you george18):
http://developer.coronalabs.com/forum/2012/11/22/has-facebook-posting-stopped-working-last-week#comment-132107

Sounds like I need to invoke feed dialog… [import]uid: 67217 topic_id: 34416 reply_id: 139872[/import]

I wonder if that only applies to the new SDK? It’s currently working fine in my live app which uses the old one.

Either way I guess it’s time to make the change and get ready to submit to apple for when the feature does go away. It’s frustrating as I have only just submitted the latest version to Apple! [import]uid: 169392 topic_id: 34416 reply_id: 139973[/import]

So I updated my script from facebook.request to facebook.showDialog( “feed”, attachment ), and it did the job very well. Ahhhh, what a pleasure it is to work with Facebook.

Naomi

P.S. And here’s a great tip from AlanPlantPot about what showDialog returns:

http://developer.coronalabs.com/forum/2012/12/06/how-can-i-post-text-facebook-feed-dialog#comment-134151 [import]uid: 67217 topic_id: 34416 reply_id: 139974[/import]

Naomi,

I’m glad you discovered that yourself. It was on my GTD today to make a comment about that possibility. The dialog working is not weird at all. It needs no permissions, since what is posted is user controlled - not server or app controlled. [import]uid: 21746 topic_id: 34416 reply_id: 139975[/import]

Thanks, Haakon. I really wanted the facebook.request to work, especially since we can pre-determine what gets posted.

With facebook.showDialog, I would be happier if we could pre-fill the text message that the user could send. I wouldn’t mind the user editing it. It’s just that pre-filling would make it so much better for the app, and makes it so much easier for the user too. But from Facebook API page, it doesn’t look like there’s any way they would allow pre-filling the message:

https://developers.facebook.com/docs/reference/dialogs/feed/

If I’m mistaken, please let me know.

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

Naomi, I have not been able to find a way… and all I have read says you can’t do that anymore. Instead I am using the name, caption and description fields to get the message across.

One issue I am now having, is that my previous link would cause the device to launch the app store or app. Now that I am using the feed dialog, it causes facebook to load the app page. Any idea how I get around that, I don’t want to give users an extra step?

This is my current URL, perhaps there is another one I should use?
https://www.facebook.com/apps/application.php?id=267797749998454

Antony [import]uid: 169392 topic_id: 34416 reply_id: 139997[/import]

Damned! So much time wasted today.
Thanks to all to share your experiences, it’s less time than it could have been.

I do too have the “The operation couldn’t be completed. (com.facebook.sdk error 5.)”, even though my code used to seem perfectly fine before. I find extremely surprising that Ansca is not on top of this issue (there are more and more tutorials on the corona website which are just not working).

Anyway, if i understand properly, facebook.request to POST an image on a facebook wall doesn’t work anymore.

facebook.showDialog should be used, but it seems it can’t upload a picture from the device (actually i could not even get it to post a picture from a website).

So, basically, is there still an option to post a picture (like a display.save) to the user’s wall or no?

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

"The operation couldn’t be completed. (com.facebook.sdk error 5.)"

I’m also getting this error (using daily build 1006). The code used to work. I believe the updated Facebook SDK integration caused this error to appear. In my case, the facebook.login( myAppID, myFBListener, {“publish_action”} ) seems to work just fine.

It breaks when I do the facebook.request( “me/friends” ) to pull down FB friends list. Immediately after facebook.request( “me/friends” ) is called, the console log shows:

didComplete: false  
Error: HTTP status code: 400  
event.name = fbconnect  
event.type = request  
isError = true  
didComplete = false  
RESPONSE: The operation couldn’t be completed. (com.facebook.sdk error 5.)  
  
-- then it continues on with the following  
event.name = fbconnect  
event.type = session  
isError = false  
didComplete = nil  
FBConditionalLog: handleOpenURL should not be called once a session has closed  

Is there a workaround for this?

@haakon, I’m not sure how I may apply your finding to my case.

@borderleap, have you heard from CoronaLabs regarding the bug you reported? Should I create and submit some test case too?

There’s nothing very complex about my setting. It simply breaks when I try to pull down user’s friends’ name and FB ID. The code used to work just fine…

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

Naomi, you need to concider what you are doing after the login phase. If you are doing a GET operation after the login phase, like get “/me” or get “/me/friends”, then your login phase must be done without requesting any publishing permissions (publish_stream, publish_actions etc).

When “/me” or “/me/frieds”:
NO: facebook.login( myAppID, myFBListener, {“publish_action”} )
YES: facebook.login( myAppID, myFBListener)

Hope that makes sense. If you find something not working after logging in with publishing permissions, just remove the permissions from the login call. [import]uid: 21746 topic_id: 34416 reply_id: 139623[/import]