Thanks for the information. I do have my invite processing working but have one more issue to resolve to get the behavior how I want it.In the didAcceptInvite function, if I determine the player is currently involved in match processing (ie: currently setting up a game or actually playing a game) then I do not want to accept their invite. I do not know how to send a cancel/reject for the invite so I plan on just ignoring it. Is there a better way to handle this?The problem I have is that when the little Invite popup banner is presented by Game Center (ie: Do you want to play?), there is no clear "YES-NO" option associated with the popup banner. Like me, I click on the banner to read more about what the banner is asking me. However, it seems I am actually accepting the invite by simply clicking on the popup banner itself. I guess this is what eventually results in the didAcceptInvite function call. At this point, since I clicked on the popup banner and accepted the match, then it seems like Game Center now considers my LocalPlayer to be associated with the new match related to the invite I just unknowingly accepted, instead of having my LocalPlayer remain associated with the game I am currently playing. As a test, when iPhone-A has the GKMatchmakerViewController currently spinning looking for random players and then iPhone-A receives a popup banner Invite request, then if iPhone-A clicks the popup banner then you will see the current GKMatchmakerViewController window stops hunting for players and clicking the "Cancel" link in the top left corner does nothing. As a result, I imagine if I was currently involved in an active game and an invite popup banner comes in, then if I click on the banner then my active game would no longer work either.The problem I see is that clicking on that little popup banner seems to mean you accepted the invite and after you do this you cannot indicate you want to cancel that acceptance.How do you handle a didAcceptInvite function being called when yo uare in the middle of an active game?
Post
Replies
Boosts
Views
Activity
>> And if your app is launched I'm not sure this is correct ....Yeah, I realized this myself as well. Please see my previous reply in the thread :>)>>Yes, your app could already be opened in foreground or background.I am making a game where all other players are waiting for each other to take turns and do stuff. If a player's application enters the background then I do not think the application can receive any messages from Game Center anymore. If this is true, then the player is missing vital information being sent from other players and is no longer in sync with other players either. In addition, all of the other players are stuck waiting for the player (who is now in the background) to do sometehing. 1) How do you handle your game for the player when the application enters the background? Do you kill the game for the player when they are about to enter the background?2) While in the background, does my application actually run at all (ie: will my timers still expire, can my code do anything, etc.)?
>>1) Since the application starts up automatically, then the view controller (which is active at the time the "didAccept match" function call comes in) should always be the main view controller of the application. Do you agree?I guess this is not true since I could already be inside my application and be located in some submenu within my application when the Invite comes in. This way I would definitely not be located in the main view controller of my application, I would be in some submenu view controller instead.
Just for fyi .... I still cannot send an Invite out from the simulator though.
ok, it just occurred to me I can connect my iPhone-B to the simulator, start my application and then just sit on the main menu screen of my game. I can now use iPhone-A and invite iPhone-B as a "Friend". This will result in all messaging relating to the Invite request being caught by the simulator, since I was connected to the simulator before the invite arrived.
Thanks for the code logic. When a player receives an Invite, then the application on the iPhone will automatically open up and start. I assume the "didAccept match" function would be called at this time. 1) Since the application starts up automatically, then the view controller (which is active at the time the "didAccept match" function call comes in) should always be the main view controller of the application. Do you agree? If so, then why do we need code logic to check for specific view controllers (ie: navigation, tabBar, etc.)? Perhaps when my application starts up then I can set a "currentViewController" variable inside the GameKitHelper class to be the correct view controller to use when the "didAccept match" function is eventually called.2) Do I have to worry about how quickly the "didAccept match" function is called automatically? Could it be called before my application has time to start up completely, thus I miss the "didAccept match" function call altogether?
In the simulator, when the GKMatchmakerViewController is displayed, I can select "Invite Friends" and select a player that I played with recently (ie: my iPhone-B). After selecting the user, I then click "send" to send the invite. The GKMatchmakerViewController indicates "Invitation Sent" but then really quickly displays "Failed". The logs indicate "The requested operation could not be completed because local player has not been authenticated." If I use the same simulator to select players randomly, then eveything works, so I know the localPlayer (ie: simulator player) is authorized already. As a result, I still cannot send an invite out using the simulator. Any ideas what sending invites from the simulator does not work?That being said, I really need to know how to obtain logging from the player who is being sent the invite. Can this be done?
To work around this unexpected issue, I store the last few received messages and then compare any new messages I received against the ones stored. if there is a match, I simply throw the new incoming message away.
ok, thanks a lot for the information. That clears it up for me. Much appreciated
My game will have a host and a non-host. The host is the player who initiates the game with the game settings defined. The non-host is simply a player who indicates they are searching for a specific game of certain setting types.The host player (ie: first player) will call findMatch() and there will never be any timer set on the host player as that player will wait forever until all other required players join.The non-host player will call findMatch() and potentially have a timer set on them to cycle through finding other game types that match their requested game criteria, if the current game type cannot be joined in a certain amount of timeQuestions1) If the host is requesting a 3-player game then why would it take the third player (non-host player) a much longer time to join the game than it did for the second player (non-host player) to join?2) If the host is requesting a 4-player game then why would the third player (non-host player) have to wait for the fourth player to be available before the third player joins?
After implementing a scrollview into my application, based on the information provided, I was able to set constraints on the buttons/labels located within the ContentView now. However, since the ContentView width and height have constraints set on them, then whenever I try to change the width (or height) of the ContentView window inside the code, then the width/height constraints are reapplied each time the viewWillLayoutSubviews method is called by the system. I had to set IBOutlets to the width/height constraints and ensure I set these constraint values in the code whenever I change the ContentView width (or height) values in the code.
Claude,Thanks for the information you sent me. I see how you were successsful in assigning all BLUE constraints to the Content View by assigning the following constraints to the Content View: Top = 0 to the Scrollview (which is the SuperView) Leading = 0 to the ScrollView (which is the SuperView) Trailing = 0 to the ScrollView (which is the SuperView) Bottom = 0 to the ScrollView (whcih is the SuperView) Width = 700 Height = 700I thought having Top, Leading, Trailing and Bottom constraints with a value of "0" means the Content View would always be the same size as the ScrollView dimensions. As a result, I still do not understand how we can can also have Width and Height constraints of 700 to be valid at the same time. This would seem to mean the Content View dimension would be greater than the ScrollView dimensions, which seem to contradict all of the "0" constraints which are set.Anyway, with your help, it seems to work, although I am still confused as to how to interpret the meaning of the constraints
I just sent you an email with the sample project. Thanks for your help ... again! :>)
Hey Claude,Please let me know how you got it working
>> Added constraints for the contentView : leading, trailing, and Top (0: content.top = superview.top + 0), Bottom (300: superview.bottom = content.bottom + 300), width (700 as proposed), height (700 as proposed)>> => Lines turn blue>> => red warning disappearWhile "Content Layout Guides" is off I then click on the ContentView to set constraints. When using Auto Layout in IB, the only constraint options I have available to select for ContentView are the following: leading = 0 to ScrollView top = 0 to ScrollView trailing = -325 to Scrollview bottom = -333 to Scollview width = 700 height = 700How were you able to set constraints for your ContentView to be pinned to the SuperView?Are you using Auto Layout to set constraints?Is your ContentView located within the Scrollview?PS: Thanks for all the help ! Looks like we are getting close