I would like like to set up the matchmaking viewController
of my game. To do so, I add the GKMatchmakerViewControllerDelegate
delegate to my main UIViewController
called Home
, so that it looks like:
class Home: UIViewController, GKGameCenterControllerDelegate, GKMatchmakerViewControllerDelegate {
To load up the matchmaking interface I am using this code:
func openMatchmaker() {
var gcViewController: GKMatchmakerViewController = GKMatchmakerViewController(rootViewController: self)
gcViewController.matchmakerDelegate = self
gcViewController.hosted = false
gcViewController.matchRequest.minPlayers = 2
gcViewController.matchRequest.maxPlayers = 2
gcViewController.matchRequest.defaultNumberOfPlayers = 2
self.showViewController(gcViewController, sender: self)
self.navigationController?.pushViewController(gcViewController, animated: true)
}
Though, I receive the following error next class Home: ...
to when I try to run the code. The error message says:
Type 'Home' does not conform to protocol `GKMatchmakerViewControllerDelegate`.
Why is that happening?