Can't Get Extended Permissions on Second Login with IOS

I need to save the Facebook user’s date of birth during their login. The DOB is an extended permission so I cannot request it on the initial FB login and must request it with a separate login. This is a known “gotcha” described in the Facebook documentation here. The workaround described in the documentation works well with Android but does not with IOS. With IOS it gives me the following message in the console: 

FBSDKLog: ** WARNING: You are requesting permissions inside the completion block of an existing login.This is unsupported behavior. You should request additional permissions only when they are needed, such as requesting for publish_actions when the user performs a sharing action.

As a test, I used the code from the Corona facebook.login documentation page (shown below) and only changed the actual Facebook permissions that I need as follows:

local facebook = require( "plugin.facebook.v4" ) local util = require("Utility") -- Check for a value inside the provided table local function valueInTable( t, valueToFind ) for k,v in pairs( t ) do if v == valueToFind then return true end end return false end local function genericFacebookListener( event ) print("genericFacebookListener") util:print\_r( event ) end -- This listener will handle the request of read-only permissions, then request publishable permissions local function intermediateListener( event ) print("intermediateListener") util:print\_r(event) if ( "session" == event.type ) then if ( "login" == event.phase ) then local accessToken = facebook.getCurrentAccessToken() -- Continue only if the user granted the read-only permissions if ( valueInTable( accessToken.grantedPermissions, "public\_profile" ) ) then facebook.login( genericFacebookListener, { "user\_birthday" } ) else print( "The user did not grant the read-only permissions" ) end end end end -- Request read-only permissions, followed by publishable permissions facebook.login( intermediateListener, { "public\_profile","email","user\_friends" } )

I received the same “unsupported behavior” warning message. Any help is greatly appreciated!

Hmm… that’s definitely not the intent on iOS.

As a work-around to this, try wrapping the facebook.login() call in a timer.performWithDelay() with some small delay.

local function secondLogin( event ) facebook.login( genericFacebookListener, { "user\_birthday" } ) end -- ... -- Continue only if the user granted the read-only permissions if ( valueInTable( accessToken.grantedPermissions, "public\_profile" ) ) then timer.performWithDelay( 100, secondLogin ) else print( "The user did not grant the read-only permissions" ) end -- ...

Hmm… that’s definitely not the intent on iOS.

As a work-around to this, try wrapping the facebook.login() call in a timer.performWithDelay() with some small delay.

local function secondLogin( event ) facebook.login( genericFacebookListener, { "user\_birthday" } ) end -- ... -- Continue only if the user granted the read-only permissions if ( valueInTable( accessToken.grantedPermissions, "public\_profile" ) ) then timer.performWithDelay( 100, secondLogin ) else print( "The user did not grant the read-only permissions" ) end -- ...