0

I have made a GKMatch and MCSession wrapper for my online games. It was working fine on Swift2 but on Swift3 I have got a weird issue.

When I am running the game with the GKMatch, it works fine, no issue. When I am changing over to the Nearby player mode and start MCSession, my game is running until I reach a scheduledTimer.

The same timer function was perfectly called on GKMatch, but now it is not fired.

All calls are the same as the wrapper is using the same delegates to interact with the rest of the software.

I cannot see any obvious issue with the code.

What is really strange is that the program is not crashing at all, just because the timer function is not fired, it stops at a point the game logic is not running further.

ClearTableTimer=Timer.scheduledTimer(timeInterval: 2.0, target: self, selector: #selector(clearTableCardsTimed), userInfo: nil, repeats: false)

    @objc func clearTableCardsTimed(timer: Timer) {
Endre Olah
  • 875
  • 2
  • 9
  • 25
  • did you add the scheduled timer in main thread? – Pranav Kasetti Oct 08 '17 at 15:55
  • No. But it is working when I connect with the other player via GKMatch. So in both case this part of the game is running on the same thread. – Endre Olah Oct 08 '17 at 16:08
  • could you please post your code here ... it would be then a bit easier to understand your circumstances – AlexWoe89 Oct 08 '17 at 16:35
  • I have added the scheduledTimer and timer function lines above. But this itself cannot be the problem. I cannot pots the complete code as it is a lot. I am logging the functions and the scheduledTimer line was definitely reached, but the function is not fired when I use the MCSession communication between the two iPhones. – Endre Olah Oct 09 '17 at 18:37

0 Answers0