GPGS plugin not logging in on iOS

Hi!

I’m currently updating my app to use the new GPGS plugin and it works fine on Android (initialises correctly, logs the user in and displays leaderboards when requested), however there seems to be an odd issue with it under iOS.

Currently the logs suggest that the plugin initialises fine, but then the login requests seem to go nowhere. The logs show that there _is_ a login request, but the listener/callback is never called and any of the behaviour that seems to be suggested by the docs (eg. Safari being opened to let the user specify login details) never occurs either.

If the login request is made with the ‘userInitiated’ flag specified as true then the log simply state this:


[Device] plugin.gpgs: init

[Device] plugin.gpgs: login()

[Device] plugin.gpgs: Is table

[Device] plugin.gpgs: luaListener

[Device] plugin.gpgs: userInitiated

[Device] ERROR: Generic error


With the ‘userInitiated’ not set, it returns this:

[Device] plugin.gpgs: init

[Device] plugin.gpgs: login()

[Device] plugin.gpgs: Is table

[Device] plugin.gpgs: luaListener

[Device] plugin.gpgs: Not userInitiated

[Device] Received Media Remote client notification kMRPlaybackQueueChangedNotification

[Device] Received Media Remote client notification kMRMediaRemoteRegisteredCommandHandlersDidChangeNotification

[Device] Received Media Remote client notification kMRMediaRemoteRegisteredCommandHandlersDidChangeNotification

[Device] Suppressing kMRMediaRemoteSupportedCommandsDidChangeNotification – client process did not ask to receive these notifications[Device] Suppressing kMRMediaRemoteSupportedCommandsDidChangeNotification – client process did not ask to receive these notifications.

[Device] #WK: Starting frame load, frame = 0x1133af180, main = 0

[Device] WF: _WebFilterIsActive returning: NO

[Device] #WK: Finished frame load without error, frame = 0x1133af180, main = 0

[Device] [0x10317ca00] Created session

[Device] #WK: Finished frame load without error, frame = 0x10f6c8000, main = 1

[Device] [0x10317ca00] Releasing session

[Device] [0x102981800] Created session


I don’t know if the ‘Generic Error’ that is returned when ‘userInitiated’ is specified is related to the request, but I assume so as it’s the next thing that occurs. Nor do I know if the Media Remote client notification errors are related, they are simply the next part of the log.

I’m fairly certain the build.settings for the OAuth2 config is correct (ie. I’ve doubled checked it, but nothing seems to make any difference).

Any thoughts?

Thanks in advance!

Hi @simonm,

Could you post your basic code on how/when you’re logging the user in (or asking them to log in)?

Thanks,

Brent

This is the chunk of code that does the init/login (it’s part of a much larger manager class, that I’ve sliced out for brevity)

[lua]

local g_GPGSInitEventID = “init”

local g_GPGSLoginEventID = “login”

_instance.m_GameNetwork = require(“plugin.gpgs”)

_instance = {}

_instance.init = function()

    local function _initCallback(event)

        if event.name == g_GPGSInitEventID then

            _instance.login()

        else

            _instance.b_LoggedIntoGC = false

            native.showAlert( “Fail”, “User is not logged into GPGS”, { “OK” } )

            debugLog("Error init GPGS: " … event.errorMessage)

        end

    end

    if _instance.b_LoggedIntoGC == false then

        _instance.m_GameNetwork.init( _initCallback )

    end

end

_instance.login = function(userInitiated)

    local function _loginRequestCallback(event)

        if event.isError == true then

            print("Error GPGS login: " … tostring(event.errorMessage))

            native.showAlert( “Error”, “Couldn’t login to Google Play Game Service”, { “OK” } )

            – print("DEBUG: " … "Error GPGS login: " … event.errorMessage)

            return

        end

        if event.name == g_GPGSLoginEventID then

            print("— Successful GPGS login")

            _instance.b_LoggedIntoGC = true

        end

    end

    _instance.m_GameNetwork.login({ listener = _loginRequestCallback, userInitiated = userInitiated })

end

[/lua]

Okay, latest update - I’ve managed to get it solved!

It’s an issue that seems to be caused when the ‘CFBundleURLTypes’ aren’t set correctly. I did actually use valid settings - with the OAuth2 client ids and so forth - but later on there were some Facebook plugin options in ‘build.settings’ which were accidentally destroying the ‘CFBundleURLTypes’ settings and putting in it’s own, rather than simply adding addition entries.

So, when the ‘CFBundleURLSchemes’ are missing for the GPGS stuff on iOS it seems to just silently die when you try to do a login. The callback is never called, nor does using ‘enableDebug’ seem to provide anything useful.

All good and well now that it’s running, but maybe the plugin giving something a bit more detailed in the log would be useful for the future? :slight_smile:

Thanks!

Simon.

Awesome.  

Just wanted to say thanks, this post possibly saved me hours of debugging.

Cheers,

Craig

My pleasure, glad it helped out! :slight_smile:

Hi @simonm,

Could you post your basic code on how/when you’re logging the user in (or asking them to log in)?

Thanks,

Brent

This is the chunk of code that does the init/login (it’s part of a much larger manager class, that I’ve sliced out for brevity)

[lua]

local g_GPGSInitEventID = “init”

local g_GPGSLoginEventID = “login”

_instance.m_GameNetwork = require(“plugin.gpgs”)

_instance = {}

_instance.init = function()

    local function _initCallback(event)

        if event.name == g_GPGSInitEventID then

            _instance.login()

        else

            _instance.b_LoggedIntoGC = false

            native.showAlert( “Fail”, “User is not logged into GPGS”, { “OK” } )

            debugLog("Error init GPGS: " … event.errorMessage)

        end

    end

    if _instance.b_LoggedIntoGC == false then

        _instance.m_GameNetwork.init( _initCallback )

    end

end

_instance.login = function(userInitiated)

    local function _loginRequestCallback(event)

        if event.isError == true then

            print("Error GPGS login: " … tostring(event.errorMessage))

            native.showAlert( “Error”, “Couldn’t login to Google Play Game Service”, { “OK” } )

            – print("DEBUG: " … "Error GPGS login: " … event.errorMessage)

            return

        end

        if event.name == g_GPGSLoginEventID then

            print("— Successful GPGS login")

            _instance.b_LoggedIntoGC = true

        end

    end

    _instance.m_GameNetwork.login({ listener = _loginRequestCallback, userInitiated = userInitiated })

end

[/lua]

Okay, latest update - I’ve managed to get it solved!

It’s an issue that seems to be caused when the ‘CFBundleURLTypes’ aren’t set correctly. I did actually use valid settings - with the OAuth2 client ids and so forth - but later on there were some Facebook plugin options in ‘build.settings’ which were accidentally destroying the ‘CFBundleURLTypes’ settings and putting in it’s own, rather than simply adding addition entries.

So, when the ‘CFBundleURLSchemes’ are missing for the GPGS stuff on iOS it seems to just silently die when you try to do a login. The callback is never called, nor does using ‘enableDebug’ seem to provide anything useful.

All good and well now that it’s running, but maybe the plugin giving something a bit more detailed in the log would be useful for the future? :slight_smile:

Thanks!

Simon.

Awesome.  

Just wanted to say thanks, this post possibly saved me hours of debugging.

Cheers,

Craig

My pleasure, glad it helped out! :slight_smile: