IOS Game Center GKLocalPlayerListener

后端 未结 3 1055
梦毁少年i
梦毁少年i 2021-02-08 20:52

I was trying to implement an event listener in a turn based game so a player can receive when his turn is active or when he is invited by a friend. GKTurnBasedEventHandler is de

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 21:23

    I believe you were there. Just this time do a couple of things. Make sure you dont add multiple listeners also before you add a listener, just incase unregister all listeners.

    I made sure I only did this once in my whole project, but I get the local player multiple times.

    -(void) onLocalPlayerAuthChanged:(GKLocalPlayer*)authPlayer {
    
        [authPlayer unregisterAllListeners];
        [authPlayer registerListener:_Whatever_];
    
    }
    

提交回复
热议问题