iphone - Game Center Multiplayer using GKMatch but seems can't be connected -
hi i'm new bie in game center ios. i'm trying add multiplayer feature using matches game , following documentation.
so far reached point 2 of clients can match, i.e. matchmakerviewcontroller:didfindmatch callback called , gkmatch object delivered.
however after seems stuck there forever, because according documentation, i'll have wait until players (2 in case) connected before starting game. seems match:player:didchangestate callback never called indicate successful connection. well, i'm sure clients in same wifi network ( or must?) 1 enlighten me on case? have things make clients connect? lot help!
so running , solution (for me) embarrasing. had copied , pasted bunch of code apple docs..and left out obvious step. never set match's delegate!
my code is:
- (void)matchmakerviewcontroller:(gkmatchmakerviewcontroller *)viewcontroller didfindmatch:(gkmatch *)match { [self dismissmodalviewcontrolleranimated:yes]; self.mymatch = match; // use retaining property retain match. self.mymatch.delegate = self; // line missing in apple docs. doh. // start game using match. nslog(@"match started! expected player count:%d %@",match.expectedplayercount, match.playerids);}
once set match delegate, functions called. doh.
Comments
Post a Comment