swift - Type 'Battle' does not conform to protocol 'GKMatchmakerViewControllerDelegate' -


i have code:

import gamekit  class battle: uiviewcontroller, gkmatchmakerviewcontrollerdelegate {   func hostmatch(sender: anyobject) {     var request: gkmatchrequest = gkmatchrequest()     request.minplayers = 2     request.maxplayers = 2     var mmvc: gkmatchmakerviewcontroller = gkmatchmakerviewcontroller(matchrequest: request)!     mmvc.matchmakerdelegate = self     self.presentviewcontroller(mmvc, animated: true, completion: { _ in }) }   } 

which should show game center standard user interface searching players, reason keeps giving me error:

type 'battle' not conform protocol 'gkmatchmakerviewcontrollerdelegate'

that whole error , have no idea how fix it. if have answer, please explain can understand it.

you getting error because class doesn't have functions (or variables) protocol gkmatchkmakerviewcontrollerdelegate wants class have.

to find out functions or variables need include, command-click on protocol name. see protocol declaration. normal functions listed there are required inside class.

functions start optional keyword aren't required enter image description here

enter image description here isn't best solution, best 1 know.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -