1 Reply
      Latest reply on Feb 7, 2020 12:47 PM by uncletr
      uncletr Level 1 Level 1 (0 points)

        Is it possible for Game Center to send the exact same data to the same player twice?

         

        I am frequently (not all of the time) noticing, the same exact data being received twice, which is causing issues in my application.

         

        I am using the following functions in GameKitHelper to send and receive data in my application:

         

        func sendDataToPlayer(data: Data!, gkPlayer: GKPlayer) 
        {
           var playerArray: [GKPlayer] = [ ]
           playerArray.append(gkPlayer)
           do {
                 try myMatch?.send(data, to: playerArray, dataMode: .reliable)
           }
           catch {
           }
        }

         

            func match(_ match: GKMatch,
                       didReceive data: Data,
                       forRecipient recipient: GKPlayer,
                      fromRemotePlayer player: GKPlayer)

         

        I am experiencing the same exact data coming into the "didReceive data:" function with the exact same data, recipient and player values

         

        Has anyone seen this duplicate data issue before?

         

        I see this issue  when testing with 2 real iPhones and the simulator (ie: 3 players).   I do not see this issue when testing with 1 iPhone and the simualtor (ie: 2 players).

         

         

        As a side question .... what is the difference between:

         

        1) match(_: didReceive: forRecipient: fromRemotePlayer:)

            and

        2) match (_: didReceive: fromRemotePlayer:)