Tuesday, September 9, 2025
HomeiOS Developmentios - How can I detect if GameCenter login animation has accomplished?

ios – How can I detect if GameCenter login animation has accomplished?


I’ve an AR maze sport lately uploaded to the App Retailer and it makes use of Sport Middle.
Till iOS 17, whereas growing, every little thing labored completely advantageous.
In iOS 18, there’s some subject between GameKit and ARKit that did not exist earlier than:
If the GK Entry Level is used (even when it is later hidden) earlier than the AR digital camera is displaying, the digital camera picture will stay black thus no world monitoring can happen. In different phrases the entire AR sport is ineffective.
I opened FB14697134 on Apple for this subject (they tried to have me shut it, however upon additional discussions they reopened it).

So now, as a short lived workaround for iOS 18, I merely do not use the Entry Level, which is a disgrace. However I do authenticate into GameCenter as I need the person to proceed to replace the leaderboards and achievements and test on them by way of inside buttons I added in my Settings VC.

My remaining subject is that whereas the Sport Middle colourful login animation is going down, if it occurs whereas the AR Scene is already proven, every little thing freezes till that animation has accomplished after which every little thing goes again to regular.
If this animation occurs shortly on the launch of the sport as a result of web connection is quick (as on WiFi) then the entire thing will full even earlier than the person will get to the third VC the place the AR Scene is proven.
But when web connection is sluggish, that animation could begin when the AR Scene is already proven after which there are 2 circumstances: both the person has already began the sport or not but.

  1. If the person did not but begin the sport, the digital camera picture will on this case stay black and it’ll present the actual world as soon as the GC animation has accomplished.
    So I added the next code to test if the AR Scene is capturing any picture and the remainder of the code to proceed the sport will solely run within the completion block as soon as the above has been confirmed:
func checkReadinessBeforeShowingMazeLevel(completion: @escaping () -> Void) {
        
        var depend = 1
        
        var timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
            if self.sceneView.session.currentFrame != nil {
                timer.invalidate()
                completion()
            }
            print("Ready (depend)")
            depend += 1
        }
    }

The depend and printing I solely added for debugging to see that it is certainly ready a few seconds.
So this works.

  1. But when web connection is even slower and the person already began to play the sport and immediately the Sport Middle animation will begin in the course of the sport, the entire sport will freeze for some 8 seconds or extra whereas the sport timer will proceed.
    That is very dangerous sport design and I might need to keep away from that (thankfully this could solely occur as soon as per sport play or every time the sport comes again into the foreground).

So the query is that if anybody is aware of if there is a method to catch if the GK authentication animation has already run/accomplished or not? I could not discover a method to test it.
If there’s a method to test this, I’ll add it to the above code and proceed the sport solely in case we all know that the GK animation has already accomplished (assuming there even is web connection as if there’s none the sport ought to proceed with out Sport Middle).

Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments