Facebook v4a plugin frequently fails to connect to Facebook

I’m using the facebook v4a plugin to login users in my app. It works fine about 70% of the time, but it frequently fails with this: 

Aug 23 11:03:52.961 [Device] -canOpenURL: failed for URL: “fbauth2:/” - error: “The operation couldn\M-b\M^@\M^Yt be completed. (OSStatus error -10814.)”

Aug 23 11:03:52.978 [Device] -canOpenURL: failed for URL: “fbauth2:/” - error: “The operation couldn\M-b\M^@\M^Yt be completed. (OSStatus error -10814.)”

I have whitelisted the facebook urls as explained in the docs (https://docs.coronalabs.com/plugin/facebook-v4a/index.html). The error comes directly after the login() function of the plugin is called. Any ideas what this means? I find it improbable that the facebook servers would refuse connection that often, that would be a huge problem for everyone using the plugin.

EDIT: just found that the error code is an apple error: kLSApplicationNotFoundErr. The description in the apple docs is “No application in the Launch Services database matches the input criteria”. If something was indeed missing, wouldn’t it be missing the whole time?

At that point I think you’re deep into the Facebook SDK native code and how it interacts with iOS. I’m not sure how much if anything we can do to look at that. Like you said it should be working or failing 100% of the time.

Rob

I did some further research and it seems indeed that this is something caused by iOS:

https://stackoverflow.com/questions/39743754/facebook-login-issue-with-ios-10

The thread above concerns iOS 10 but apparently it still has not been fixed. This seems only to be happening when FB login is done via browser, not via the app. Also, there seems to be some plist settings that can solve the issue. Wouldn’t that be possible to incorporate in the build-settings file?

In your build.settings, you will find a:

settings.iphone.plist sub-table:

settings = {       iphone  = {            plist = {            }      } }

As far as I know, you can put any valid plist entry in that table, though you have to include it in Lua, not pList format, so if it’s a dictionary, you will have to convert it to a Lua table. If it’s a string or int, those are pretty straight forward.

Rob

I didn’t know I could put any plist entry there… I get how to use booleans and strings but not integers and tables. Is it like this?

settings = { iphone = { plist = { UIVariableInteger = 23, UIVariableDictionary = { first = "first", second = "second"}, } } }

Yes.

Ok, thanks!

It turns out that was not the only problem… About 20% of the errors is in fact something else. A loginFailed event is triggered:

table: 0x280b31100 { Aug 30 01:16:15.821 [Device] [type] =\> "session" Aug 30 01:16:15.821 [Device] [name] =\> "fbconnect" Aug 30 01:16:15.821 [Device] [phase] =\> "loginFailed" Aug 30 01:16:15.822 [Device] [isError] =\> true Aug 30 01:16:15.850 [Device] [response] =\> "The operation couldn\M-b\M^@\M^Yt be completed. (com.facebook.sdk.login error 308.)" Aug 30 01:16:15.850 [Device] } 

To be clear, login works sometimes (i.e. all permissions etc are in order) but not always. Googling this did not give much help except that it could be an issue with an old Facebook SDK version.

Anyone else seen this?

EDIT: it seems this is a pretty common error across all platforms. Many suggestions are given in platform specific forums on it can be resolved on that particular platform. Seems like we need a Corona specific way to solve this.  

Facebook v4a definitely results in failed logins regularly. We’ve had to prompt the user to try again. Sometimes it will happen 4 times in a row and then finally it works.

The issue here is that the Corona team, as much as I love them, hasn’t put any adequate time into updating the Facebook SDK to a newer version - they are right, it should still work. But for most of 2019, it has become terribly unreliable for login.

I think the FB SDK used by Corona will eventually be deprecated, at which time; the team will finally update the plugin.

I agree, the plugin is at a point where it is almost unusable. Sometimes every second login attempt fails. It’s embarrasing because my app gets blamed for it by the users. Putting something in the plist as described above is a temporary workaround, not a solution.

@Corona staff: are there any plans to update/fix the v4a plugin?

I’ll ask Engineering.

@Rob: Any news from engineering?  

@Rob, any news on this?

I understand that engineering has a lot of stuff to do but this is kind of an important plugin and I am getting complaints from my users, which is embarrasing. When I test it myself, it sometimes fails every other time… Could you please ask engineering to prioritize this? I’m guessing there are a lot of people affected by this. 

I agree, this has been a problem for months and months!

We are working on it.

@Rob, Any new update on this?

They are working on it.
;) 

We have updated just about everything that touches FAN and Facebook. 

FB changed to have a central core library that both FAN and Facebook both use. So this starts a whole new dependency setup for FB. Since Appodeal (both iOS and Android) use FAN, it was also being impacted. Then FB decided to include a library that conflicted with the Zip plugin.

Anyway, it should all be straightened out with bright new shiny plugins for all of them. See: 

https://forums.coronalabs.com/topic/75884-fan-plugin-sdk-too-old/#entry404460

to get the version numbers and everything that changed.

Rob

@Rob: that’s great, thanks! Three questions:

  1. What’s the FAN plugin?

  2. Do I have to do something with the Appodeal plugin because of this dependency?

  3. Do I get the updated FB-plugin when I rebuild or do I have to download the latest Corona version? 

Again, thanks for fixing this plugin!

  1. The FAN Plugin is Facebook Audience Network. It’s an advertising plugin from Facebook. It comes in a 5% revenue share model or a paid plugin model with no revenue share.

  2. Because FAN is one of the ad providers for Appodeal, we had to update update the Appodeal plugin and the adapter plugins that goes with it.

  3. No. It works with 2018.3326 and later.

Rob