When Game Center determines a player is forced to disconnect from a match, Game Center sends a disconnect message via the "didChange state" function. However, not all devices connected to the match are receiving the disconnect state change message. One device will think the player is disconnected, but there is still messaging passing from the (supposedly) disconnected player to the other players in the match.The only way I can think to resolve this issue is have all players poll Game Center to obtain updated match information. Based on this updated match information then all players can determine what players are truly still connected properly or not.Can Game Center be polled to obtained updated match information? If so, how?Any other ideas how to resolve the issue when all players do not receive the same disconnect state chaneg from Game Center?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I discovered the Game Center playerID has been deprecated in iOS 13.0 and we should use teamPlayerID or gamePlayerID instead. I started to play around with teamPlayerID value since Apple indicated in most cases we would be using the teamPlayerID value.A) Once a match has been created, the teamPlayerID can be obtained for each player by looping through each player in the match (myMatch).for player in myMatch.players
{
print("teamPlayerID = \(player.teamPlayerID)")
}B) The teamPlayerID can also be obtained by calling the GKPlayer.loadPlayers(forIdentifiers:) function to obtain all player information. You can then loop through the player information to obtain the teamPlayerID for each player.(Note: Creating the player map array using $0.teamPlayerID does not result in any data being returned)let playerIDs = myMatch!.players.map { $0.playerID } as [String]
GKPlayer.loadPlayers(forIdentifiers: playerIDs) { (players, error) in ...
for player in players
{
print("teamPlayerID = \(player.teamPlayerID)")
}Issues Found:1) If Player1 performs (A) and (B) then they will notice the teamPlayerID values from (A) are not the same values as the ones from (B)2) If Player1 performs (A) and Player2 performs (A), then both players will have different teamPlayerID associated with them both? Meaning ...Player1 sees a different teamPlayerID value for Player2 than Player2 sees for themselvesPlayer2 sees a different teamPlayerID value for Player1 than Player1 sees for themselvesAs a result of these two issues, it does not seem the teamPlayerID value can be used to uniquely specify a particular "player" in Game Center. I confirmed one player cannot send data to another player since both players do not have the same teamPlayerID values that represent each player in the match. (Note: The same issue exist for the gamePlayerID value as well)How can we use teamPlayerID to associate with a specific player in a match, when each player in the match has different teamPlayerID values for the players in the match?
I have an imageView which has a top constraint IBOutlet called imageViewTopConstraint. In viewWillLayoutSubviews( ) I set the imageViewTopConstraint.constant value. The imageView displays properly for all iPhone models while in portrait mode, which is good.When I switch to landscape mode, I want to disable the imageViewTopConstraint, so the viewWillLayoutSubviews( ) has the following code:if UIDevice.current.orientation.isPortrait {
imageViewTopConstraint.constant = (2 * screenHeight) / 3
imageViewTopConstraint.isActive = true
}
else if UIDevice.current.orientation.isLandscape {
imageViewTopConstraint.isActive = false
}IssueWhen I run the application it is initially in portrait mode. When I switch to landscape mode I receive the following fatal error at the line where I set "imageViewTopConstraint.isActive = false" to disable the constraint (line 6 above) Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional valueAny idea what is going on or what this means?
In Xcode 10, there was a button for the Object Library located left of the "inspector" buttons. After the upgrade to Xcode 11 occurred, this button no logner exists. Where did it go?