I toggled my "mute button", which switches images back and forth (mute/unmute/mute/etc.) and then used "print" to display the "mute_button" view object after each time the image was reloaded to the new image. The output is below. It seems the addresses stay the same<print output not allowed to be displayed ... since "It is being moderated" for some reason>I cannot figure out how to set an UIImage view to NIL before reloading .... any ideas?
Post
Replies
Boosts
Views
Activity
I will update my code to always set the image to NIL before setting a new image (see below) and let you know:myButton.setImage(nil, for: .normal)
myButton.setImage(UIImage(named: myNewButtonImageFile), for: .normal)In my card game application I am seeing memory constantly increase throughout the game. Since there is only 52 different card images which can be displayed throughout the game, I would expect the memory to "level-out" eventually once all various card images have been loaded one time. I was just concerned whether reloading the same card images over and over into Button or UIImage views, while playing multiple rounds of cards, would keep increasing the memory footprint. This is why I wondered if constantly loading new images into UIViews (and Buttons) would cause memory to keep increasing even if the image was loaded once before.
>>There's probably a simpler way, by setting image to nil, as described here:Does this mean I should set the UIImage "image" to nil right before loading any new image like the following?Does the same memory issue occur when setting images on Buttons (instead of UIImages) as well with the following? setImage(UIImage(named: myButtonImageFile), for: .normal)
ResolvedAfter updating to 13.4.1, this issue has been resolved for me
I have leaderboards in my game which keep high scores. My application was released to the App Store and approved yesterday. Today I went into my leaderboards and removed all the scores from each leaderboard manually, following the steps below. I am not sure if this is what you are looking for or not, but thought I would share:log into App Store ConnectClick on My AppsClick on app containing target leaderboardClick on "Features" (top bar)Click on "Game Center" (side bar)Under "Group Leaderboards" click "More"In popup, click "Manage Scores and Players"
I have the exact same issue. My iPhone has 13.4 iOS and I can send (or receive) an Invite request for my game application but the GKMatchmakerViewController for both players (inviter and invitee) remain stuck at "Connecting". Using the iOS simulator I was able to verify the "didFind match" function is being called, however, the expectedPlayerCount is not 0 so the match never starts. Also, the "didChange state" function is never called to indicate the other player has "connected", so the match still never startsEDITAfter updating to 13.4.1, this issue has been resolved for me
dnnny,I had the exact same issue. My iPhone has 13.4 iOS and I can send (or receive) an Invite request for my game application but the GKMatchmakerViewController for both players (inviter and invitee) remain stuck at "Connecting". This is on real devices on my Apple Store appAfter updating to 13.4.1, this issue has been resolved for me
I have leaderboards in my game which keep high scores. My application was released to the App Store and approved yesterday. Today I went into my leaderboards and removed all the scores from each leaderboard manually, following the steps below. I am not sure if this is what you are looking for or not, but thought I would share:log into App Store ConnectClick on My AppsClick on app containing target leaderboardClick on "Features" (top bar)Click on "Game Center" (side bar)Under "Group Leaderboards" click "More"In popup, click "Manage Scores and Players"
I created a ticket for this issue --> Follow Up 733460705I created a test application which sends/receives data between connected devices similar to how my game sends/receives data between the players in the game. It allows one player to be the host and other players to be non-hosts. When the test application starts, it will create the matches like my applicaiton does and then start sending/receiving data between the players. The test application displays the connection status (Connected/Disconnected) for each player and also indicates which player is currently sending/receiving data. I will provide this application to Apple when requested.When running the test application, I can have one player quit the match and see that all players do not receive a disconnect message. usually 1 of the 3 remaining players gets the discsonnect only.
>>It is player 2 who has the status of GKPlayerConnectionState not player 1Agreed. Player 1 receives the disconnect which informs Player 1 that Player 2 has disconnected. I will look into how to report a bug.
I already have print statements for connect/disconnect (see updated code snippet below). I simply did not want to bother you with print statements earlier so did not include them.When the issue is reproduced and one of the players who did not receive the disconnect message was connected to the Xcode simulator then the disconnect "print" statements are not seen at all. I decided to play a sound file instead so I could confirm the results on all connected devices which were not connected to the simulator.Note: The "player connected" print statement always is seen for initial connection of all playersfunc match(_ match: GKMatch, player: GKPlayer, didChange state: GKPlayerConnectionState)
{
switch (state)
{
case GKPlayerConnectionState.connected:
print("PLAYER CONNECTED! = \(player.displayName)")
etc.
case GKPlayerConnectionState.disconnected:
print("PLAYER DISCONNECTED! - \(player.displayName)")
DispatchQueue.main.async {
print("PROCESSING PLAYER DISCONNECT - \(player.displayName)")
self.soundError?.play()
etc.
}
default:
print("state unknown")
}
}PS: The player that Game Center has indicated was disconnected remains connected with some of the other players in the game and can still send/receive data. Based on this additional fact, I know some of the other players did not receive the disconnect themselves and still maintain a network connection via Game Center
>>Check your code to be sure it is doing what you say it is doingCode is functioning perfectly and everything works as designed until Game Center sends a disconnect to only some of the players.>>Note that if you issue a sound off the main queue it won't make a sound. (i.e. in didChangeState you need dispatch_async(dispatch_get_main_queue(), ^{ ).Sound is already inside DispatchQueue.main.async (see below)func match(_ match: GKMatch, player: GKPlayer, didChange state: GKPlayerConnectionState)
{
switch (state)
{
case GKPlayerConnectionState.connected:
etc.
case GKPlayerConnectionState.disconnected:
DispatchQueue.main.async {
self.soundError?.play()
etc.
}
default:
print("state unknown")
}
}>> .. be sure the device in question is set to issue the sound (Do Not Distrurb, that switch on teh side, etc.).All iPhone devices used during testing have the sound enabled. Also my Mac has the sound on for the Xcode simulator player as well.
I assumed more developers would have changed the default invite image and would have seen this issue. Has anyone been able to do this successfully?
>>This is incorrect. All players get the call to didChangeState. Isn't that cool!It would be cool if it was working that way, but it is not working that way :>(I understand all players in the game should be receiving a "didChange state" disconnect message, however, I have proven that this is not occurring when Game Center initiates the disconnect itself. When a "didChange state" disconnect comes in, I have my code play a particular "sound file" so I can prove whether the disconnect came in via "didChange state" on all iPhone devices playing the game. When this issue occurs, some player devices (iPhones) are not playing the sound file, so this indicates some player devices are not getting the "didChange state" disconnect indication. The device which did not play the sound file are truly still connected to the player who seemingly disconnected from Game Center as wellNo players in the game are actually disconnecting themselves so the disconnect is being generated from Game Center. MOST times, when Game Center initiates a disconnect for a player then only 1 (or occasionally 2) other players receive the disconnect message via "didChange state" only, thus leaving the game out of sync. I have seen Game Center initiate spurious disconnects in my 3 and 4-player games. My card game takes about 20-25 minutes to play and a Game Center initiated disconnect will occur in about 60% of the games played, thus very annoying. Sometimes even the player Game Center indicated has disconnected might not receive the "didChange state" disconnect message themselves and that player will still remain connected to other players and can still send/receive data. It is very odd.The player that Game Center disconnected actually remains connected to some of the other players in the game and can send data back and forth with these other players. The player who "received" the disconnect from Game Center can also interact with some of the remaining players as well, but is truly disconnected from the player the Game Center disconnect was related to (of course). This means Game Center is only reporting the disconnect related to the network connection which has gone down only, and not informing all players about this disconnection.If all players were to receive the same disconnect from Game Center, as expected, then my game would handle the disconnect properly and allow the remaining players to finish their game. However, when only some of the players receive a disconnect then the game is compeltely out of sync and there is nothing I can do ... unless there is a way I can poll Game Center for a fresh overall match status of all players to determine whether any other players have been truly disconnected without some players knowing about it. I would then be able to initiate the proper "missing" disconnects myself and save my game play.
This issue is even worse as I see Game Center sending a DISCONNECT for one player during gameplay. The DISCONNECT seems to come in at any time. Most of the time, the DISCONNECT is only received by one of the players. The player who seemingly disconnected remains connected to other players though and can still send data back/forth between the other players.I am assuming Game Center sends a DISCONNECT when the network connection goes down, but ...Why does the Game Center network connection go down so frequently? My game takes about 20-30 minutes to play completely and I experience a Game Center DISCONNECT during every otehr game I play.Why does Game Center not inform any of the all players about the DISCONNECT which has occurred?Perhaps I should create an Apple Issue/Ticket on this issue.