ios - GKMatchmaker findMatchForRequest invite never received -


i'm trying invite nearby players match, invite either never sent or never received.

gkmatchmaker startbrowsingfornearbyplayerswithhandler works , returns nearby players on same wifi, use findmatchforrequest , returns match without players, , players try invite never receive invite notification. here code.

i start authenticating local player:

gklocalplayer.localplayer.authenticatehandler= ^(uiviewcontroller *controller, nserror *error) {     if (error)     {         nslog(@"%s:: error authenticating: %@", __pretty_function__, error.localizeddescription);         return;     }     if(controller)     {         // user has not yet authenticated         [pviewcontroller presentviewcontroller:controller animated:yes completion:^(void)          {              [self lookfornearbyplayers];          }];         return;     }     [self lookfornearbyplayers]; };  -(void)lookfornearbyplayers {     if(!gklocalplayer.localplayer.authenticated)     {         nslog(@"%s:: user not authenticated", __pretty_function__);         return;     } 

i register view controller delegate of gklocalplayerlistener:

    [gklocalplayer.localplayer registerlistener:self]; // self view controller.      // works. test local player second device , appleid setup shows when handler called.     [gkmatchmaker.sharedmatchmaker startbrowsingfornearbyplayerswithhandler:^(gkplayer *player, bool reachable)     {          nsarray * paplayers= [nsarray arraywithobject:player];          _pmatchrequest= [[gkmatchrequest alloc] init];          _pmatchrequest.minplayers= 2;          _pmatchrequest.maxplayers= 4;          _pmatchrequest.recipients = paplayers;          _pmatchrequest.invitemessage = @"join our match!";          _pmatchrequest.recipientresponsehandler = ^(gkplayer *player, gkinviteeresponse response)          {              // never called.              nslog((response == gkinviteeresponseaccepted) ? @"player %@ accepted" : @"player %@ declined", player.alias);          };           // returns match without players.          [gkmatchmaker.sharedmatchmaker findmatchforrequest:_pmatchrequest withcompletionhandler:^(gkmatch *match, nserror *error)           {               if(error)               {                   nslog(@"%s:: %@", __pretty_function__, error.localizeddescription);                   return;               }               else if(match != nil)               {                   _pmatch= match;                   match.delegate = self;                   nslog(@"players count= %lu", (unsigned long)_pmatch.players.count); // returns 0               }           }];      } } 

i have delegate methods gklocalplayerlistener setup, never called:

- (void)player:(gkplayer *)player didrequestmatchwithrecipients:(nsarray<gkplayer *> *)recipientplayers {     nslog(@"%s", __pretty_function__); }  - (void)player:(gkplayer *)player didacceptinvite:(gkinvite *)invite {     nslog(@"%s", __pretty_function__); } 

does know how work without gkmatchmakerviewcontroller , ios9? examples can find have deprecated -invitehandler method.

this code working in swift if know how can convert objective-c , try it.

gkmatchmaker.sharedmatchmaker().findmatchforrequest(     request,     withcompletionhandler: {(match : gkmatch!, error: nserror!) -> void in         nslog("this works") }) 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -