How do I hide GKAccessPoint?

Hello, I am using GameKit for the first time, since the new AccessPoint was announced on WWDC 2020, but cant figure out how to hide the AP outside of main menu. I am getting this exception when calling .isActive = false -> Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1ae03f6a4)

How am I supposed to hide it? Thanks!

XCode Version 12.0 beta 5 (12A8189h)
Code Block
struct ContentView: View {
let localPlayer = GKLocalPlayer.local
func authenticateUser() {
localPlayer.authenticateHandler = { vc, error in
guard error == nil else {
print(error?.localizedDescription ?? "")
return
}
GKAccessPoint.shared.location = .topLeading
GKAccessPoint.shared.showHighlights = false
GKAccessPoint.shared.isActive = localPlayer.isAuthenticated
print(localPlayer.isAuthenticated)
}
}
var body: some View {
NavigationView {
NavigationLink(destination: Text("asdd")) {
Text("Play Game")
.onDisappear {
print("onDisappear")
print("isVisible: \(GKAccessPoint.shared.isVisible)")
GKAccessPoint.shared.isActive = false /* THIS CRASHES THE APP */
}
}
}
.navigationViewStyle(StackNavigationViewStyle())
.onAppear {
print("onAppear")
authenticateUser()
}
}
}

We have the same issue, appears this was introduced in the latest betas of macOS and iOS.

As soon as we attempt to hide the access point the app will terminate

Code Block objc
GKAccessPoint.shared.active = false; // crashing


Facing the same issue. This was NOT happening in Beta 3. I experienced this issue only after upgrading to Beta 5.
Also, the crash happens only AFTER the GKAccessPoint is made visible once.
i.e. after GKAccessPoint.shared.isActive is set to true, and then later set to false.
Setting it to false all throughout, without making it visible even once, doesnt cause any crash.
Apple advised that you place you access point in a view which is not your main view, that way, you won't have to worry about hiding it. But if you still want to hide it, you could try set
Code Block
GKAccessPoint.shared.active = false

in your authenticateUser() method like below.

Code Block
func authenticateUser() {
localPlayer.authenticateHandler = { vc, error in
guard error == nil else {
print(error?.localizedDescription ?? "")
return
}
GKAccessPoint.shared.location = .topLeading
GKAccessPoint.shared.showHighlights = false
GKAccessPoint.shared.isActive = false
print(localPlayer.isAuthenticated)
}
}


How do I hide GKAccessPoint?
 
 
Q