Cordova-plugin-facebook4 Facebook login not opening on iOS

#1

Hello,

I have a problem with cordova-plugin-facebook4 (https://github.com/jeduan/cordova-plugin-facebook4) on iOS devices. After following the installation procedure as indicated in the documentation (“iOS Guide”) and configuring correctly the app in the Facebook Developer Console,
when I click on my Facebook login button nothing happens. The XCODE console outputs the following error:

2019-02-15 17:22:58.678937+0100 HelloCordovaApp[59179:1228209] Logging in with CORDOVA ... 2019-02-15 17:22:58.692742+0100 HelloCordovaApp[59179:1228209] Checking login status: unknown 2019-02-15 17:22:58.692947+0100 HelloCordovaApp[59179:1228209] Performing Fb login ... 2019-02-15 17:22:58.693087+0100 HelloCordovaApp[59179:1228209] Starting login 2019-02-15 17:22:58.693271+0100 HelloCordovaApp[59179:1228209] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Permissions should each be specified in separate string values in the array. 2019-02-15 17:22:58.694627+0100 HelloCordovaApp[59179:1228209] Client application failed to make a policy decision via WebPolicyDecisionListener, using defaultPolicy 2

The app I developed is written in AngularJs and it’s wrapped using Cordova.
What could it be? On Android devices it works perfectly…
Here’s the code that’s executed when user clicks on my Facebook login button:

function fbLoginButtonClick(){
	console.log('Logging in with CORDOVA ...');
	facebookConnectPlugin.getLoginStatus(_fbLoginStatusSuccess, _fbLoginStatusError);
}

////////

function _fbLoginStatusSuccess(response) {
	var responseStatus = response.status;
	console.log('Checking login status: ', responseStatus);
	if (responseStatus === 'connected') {
	  _fbLoginSuccess();
	} else if (responseStatus !== null) {
	  _doFbLogin();
	} else {
	  handleFacebookError(responseStatus);
	}
 }

function _fbLoginStatusError(error) {
	handleFacebookError(error);
}   
 
function _doFbLogin() {
	console.log('Performing Fb login ...');
	facebookConnectPlugin.login(['email, public_profile'], _fbLoginSuccess, _fbLoginError);
}

function _fbLoginSuccess(result) {
	console.log('Fb API: getting user data ...');
	facebookConnectPlugin.api('/me?fields=id,name,first_name,last_name,email', ['email', 'public_profile'], _fbApiSuccess, _fbApiError);
}

function _fbLoginError(error) {
	handleFacebookError(error);
}  

function _fbApiSuccess(userData) {
	alert('User Authenticated!!');
	//redirect to admin page
}

function _fbApiError(error) {
	handleFacebookError(error);
}

function handleFacebookError (error) {
  if(error){
    console.log(error);
  }
}

And this is the configuration on my config.xml file:

<plugin name="cordova-plugin-facebook4" spec="4.2.1">
    <variable name="APP_ID" value="************" />
    <variable name="APP_NAME" value="HelloCordovaApp" />
    <variable name="FACEBOOK_HYBRID_APP_EVENTS" value="false" />
    <variable name="FACEBOOK_ANDROID_SDK_VERSION" value="4.40.0" />
</plugin>