[iOS] Social.Authenticate bug on user cancel ?

Hi,

I’m currently implementing the Game Center for my app, and I’m running into a problem:

  1. At Authentication time, I call Social.localUser.Authenticate(GCAuthenticationHandler); and it works like a charm => I get my AlertView showing and prmpting me to login.
  2. If I do login, everything is fine => user gets recognized and I can report/display scores.
  3. Though if I press the CANCEL button at login time, here comes the problem => it does cancel the login as it should, but from that point forward I can never login again (by calling Social.localUser.Authenticate(GCAuthenticationHandler); again) unless the app is killed. Unless I kill my app, all I get is Failed to authenticate local user The requested operation could not be completed because local player is already authenticating.

It seems like Unity doesn’t terminate the process of authentication if the user cancels, and there is no way for me to manually “reboot” this process.

This is very bad and definitely not user-friendly to have to kill your app in case you didn’t want to login to GC at the first place, or even if you did hit the cancel button by mistake…

If anyone encoutered this problem, or know anything about this, please post. Otherwise I guess I’ll have to file a bug to them.

Thanks

This is not a bug within Unity. I know this because I am having the exact same problem while writing straight Objective-C code in XCode. My issue is exactly the same as yours; posted a SO question regarding it here:

Hopefully someone will respond with a solution!

So I looked into the unity script reference documentation and found the following statements.

http://unity3d.com/support/documentation/ScriptReference/ILocalUser.Authenticate.html

Authenticate the local user to the
current active Social API
implementation and fetch his profile
data.

This should be done before any other
calls into the API. Depending on the
platform this might trigger a blocking
dialog for providing login details.

I guess this is an iOS thing, it gets blocked. It says a comment about go to the Game Center and log in. So I believe the solution might be to let the iOS handle it this way.

This reminds me of not using any exit application code in iOS apps. You should only use the home button, well it seems they want the game center authentication to maintain the uniformity.

I am going to solve this on my game removing the leader-board link in my app if authentication fails, and only displaying it in case it succeeds.

I hope this helps,

Danny