How to send Invite to iPhone using IOS simulator

I am able to start a 2-player match between the IOS simluator and my connected iPhone. The IOS simulator starts hunting for a two player game using the GameKit Matchmaker View Controller and the iPhone requests a two-player match by entering my game application as well. Of course, the IOS simulator and my iPhone are using separate Game Center accounts to make this possible.


I now want to test sending a true "Invite" request from the IOS simulator to the iPhone. When requesting a match in the IOS simulator, I can see my iPhone "user" is listed under the "Recently Played" section of the GameKit Matchmaker View Controller display window, after clicking the "Invite Player" button of course. When I select my iPhone "user" and then select "Play Now", my iPhone never receives an Invite request because the IOS simulator generates the following error:


GKMatchmaker: invitePlayersWithRequest: - Error Inviting Players Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server."


UserInfo=GKServerStatusCode=5008, NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server., NSUnderlyingError=0x600002761c20 Error Domain=GKServerErrorDomain Code=5008 "status = 5008, missing required key: self-push-token" UserInfo={GKServerStatusCode=5008, NSLocalizedFailureReason=status = 5008, missing required key: self-push-token


Can the IOS simulator be used to Invite iPhone users? If so, what does the error mean and how can I fix it?


Does my iPhone have to be inside my game application to make this work ... I hope not.

Accepted Reply

In answer to your question:

"How does someone test player "Invites" before releasing the application into the App Store?"



You load one iPhone with the app using Xcode and you disconect it. You then load another iPhone with the app using Xcode and you either leave it connected (and debugging) or you disconnect it. The two iPhones can send (and receive) notifications to (from) each other


Alternatively you use TestFlight.

Replies

In answer to your question:

"How does someone test player "Invites" before releasing the application into the App Store?"



You load one iPhone with the app using Xcode and you disconect it. You then load another iPhone with the app using Xcode and you either leave it connected (and debugging) or you disconnect it. The two iPhones can send (and receive) notifications to (from) each other


Alternatively you use TestFlight.

I had no idea you could use a disconnected iPhone for testing. I thought the iPhone had to be connected to the Mac PC for testing. However, using two iPhones to test "Invite" functionality means I will not be able to see any debug output on the simulator, so I really have no way of confirming the code implementation paths are working properly.


I guess I would have to implement some TextView object (as part of my application) for testing purposes on iPhones. The TextView object would be populated with "print" statement output from my application to allow me to see what is going on when testing with real iPhones directly. Is this what people are expected to do?

> I really have no way of confirming the code implementation paths are working properly.


The one iPhone connected to the computer/Xcode will provide debug information. At worst, you may have to do things twice to get both sides of the debug story.

ok, I think I understand, but perhaps you can confirm?


I have a real "iPhone1" connected to the Mac and the IOS simulator runs the application on this "real iPhone1". The "real iPhone1" can then go into the application and "Invite" the second "real iPhone2" user to play the game. I can see the debug information from "real iPhone1" on the simulator.


I then reverse the test using iPhone2 to invite iPhone1 to see the invite request coming into iPhone using debug output.

I assume by "real" in quotation marks you mean a real physical iPhone and the quotations are not meant to suggest non-physical.

Your use of "the IOS simulator" is a bit incorrect. The physical iPhone is not using "the IOS simulator". It is using "Xcode" and operating under the debugger in Xcode. There is a separate app on your phone called "Simulator". You are not using that when you have a physical device attached.


Otherwise - I confirm.

ok thanks for verifying. Yes, "real" means a real physical iPhone. :>)