“Extension cancelled by host” when gameCenterViewControllerDidFinish is called?

Hi,
Gamecenter works, score is added etc. Leaderboard shows fine, and when I press "done" it is dismissed and the app doesn't crash and I can continue to play, but when I press done also I do get the error message as shown below (the dismiss works and the animation works but still this error is written to console):

Error] Extension request cancelled with error: Error Domain=NSExtensionErrorDomain Code=-2 "Extension cancelled by host." UserInfo={NSLocalizedDescription=Extension cancelled by host.}

I auth the player in my gameviewcontroller which works fine. The leaderboard is presented and dismissed from my main scene as follows:


import SpriteKit
import GameplayKit
import GameKit

    class HomeScene: SKScene, GKGameCenterControllerDelegate {

    ....

     override func touchesEnded(_ touches: Set, with event: UIEvent?) {

            for touch in touches {

              let location = touch.location(in: self)

               if leaderboardNode.contains(location) {

                    let viewControllerVar = self.view?.window?.rootViewController
                    let gKGCViewController = GKGameCenterViewController()
                    gKGCViewController.gameCenterDelegate = self
                    viewControllerVar?.present(gKGCViewController, animated: true, completion: nil)
                  }

              }

        }

        func gameCenterViewControllerDidFinish(_ gameCenterViewController: GKGameCenterViewController) {
            gameCenterViewController.dismiss(animated: true, completion: nil)
        }

    }


Does anyone recognize this? Why am I getting this message?

Replies

Did you ever sort this out in the end?