- Home /
[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:
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.
If I do login, everything is fine => user gets recognized and I can report/display scores.
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
I am having this same problem... Any luck with solving this so far Le_nain?
After 20 days without anyone telling me I'm mistaken, I can assume that this is a bug. Reported it today (24/04/12) through Unity's Bug Report, if anyone is willing to see the state of the ticket it can be found here : http://fogbugz.unity3d.com/default.asp?460166_b18pft9s8g64ur55
So 3 years later, I'm still getting this. Testing with the iiPad 2. Anyone have a solution? I even notice this in released games in the top charts.
Answer by WKiddBdot · Apr 26, 2012 at 04:55 PM
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!
Well, that surprises me, considering that I used to work for me before Unity 3.5 was released (I was using Prime31's plugin). Though, looking at your pots on stackoverflow, I can't really deny what you're saying here and call you a liar ;) since you described exactly my problem. $$anonymous$$aybe this is just a coincidence, there might have been a "cross-update" between iOS and UT around the same date which made me believe it comes from UT. Anyways, thanks for your answer, it won't change much my problems as I already considered it as a "not fixable by myself bug" but at least I know the real culprit. I can now point my finger at Apple and shout my "DA$$anonymous$$N YOU" ;)
Answer by DANNY · Apr 18, 2012 at 04:56 AM
So I looked into the unity script reference documentation and found the following statements.
http://unity3d.com/support/documentation/ScriptReference/ILocalUser.Authenticate.htmlAuthenticate 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
Hi DANNY, - About the "blocking dialog for providing login details.", they just mean that the AlertView that pops for you to provide the login details is modal, meaning this is the only thing that can take input at this time (=>"blocking"). - And about the "comment about go to the Game Center and log in", you're right, it IS part of the GameCenter process to prevent the login popup to appear, but only if the user did dismiss the login popup several times in a row (the number "3" pops out in my $$anonymous$$d, if I recall correctly). This is fine because it's designed to be as is, but BEFORE you dismiss the login popup 3 times in a row you should be able to display the popup at will (I was using Prime31's plugin until Unity3.5, and it worked as intended)
So it definitely is a bug. I didn't have time to file it yet with a repro case, but I'll definitely do that a the Unity $$anonymous$$m needs to know about it. Still, thanks for your answer :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613065812im_/https://answers.unity.com/themes/thub/images/avi.jpg)