Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8611569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:24:32+00:00 2026-06-12T04:24:32+00:00

i establish a connection between two iOS devices with GameKit and GKMatch for a

  • 0

i establish a connection between two iOS devices with GameKit and GKMatch for a synchronous game. When one player enter the background the connection will disconnect. How can I avoid this behavior? Is it possible to keep the connection via GKMatch alive while one user did suspend the app to the background?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:24:33+00:00Added an answer on June 12, 2026 at 4:24 am

    According to Apple’s documentation:

    As soon as your game moves to the background, the value of the local player object’s authenticated property becomes and remains invalid until your game moves back to the foreground. You cannot read the value to determine if the player is still authenticated until Game Kit reauthenticates the player and calls your authentication handler. Your game must act as though there is not an authenticated player until your completion handler is called. Once your handler is called, value stored in the authenticated property is valid again.

    Source: Game Center Programming Guide, pg. 39.

    Unless your App employs VOIP or special circumstances apply, you shouldn’t really be keeping a network connection open in the background. (If you are interested though, check out this SO question for a hacker-ish way of going about that).
    As your player authentication is invalidated on entering the background, another device (if it does manage to receive network data from the background App) will not (reliably) know which GKPlayer sent the information.

    So while Apple don’t come out and say it explicitly, all Game Center features should normally be cancelled when the Application enters the background, and resumed once the player is re-authenticated upon relaunch.

    As a side note, when an App withdraws to the background it is (usually, depending on background tasks) deemed “eligible for suspension”. This is one reason there are such restrictions on multitasking execution – your App could be killed at any moment to free memory and you don’t really want a heavy duty data transfer going on when that happens!
    See TN227 if you’d like to know more about networking and multitasking.

    EDIT: An alternate method:

    While it is not possible to keep a GKMatch alive while an App is running in the background, an alternative way to emulate this behaviour would be to save game state to your own server. Ask the user to interact with some UI (press a button maybe) before she/he leaves the game, which saves the current game state to your own server and notifies the other player that you are about to leave the game. Upon relaunch, query your server to see if you have any saved games, and if so, load the game state and send a notification to the other player. This doesn’t strictly maintain the same game, but is one way of approximating the behaviour you’re after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to establish a connection between two boxes that are
I need to establish a Socket connection (TCP) between two hosts (say host1 and
As the title says, is it possible to establish P2P connection between two systems
I need to establish a P2P UDP and TCP Connection between two Users. Both
I cannot establish a connection between two players using auto-match and GKMatchmakerViewController. The behavior
I want to establish a connection between my local machine and MySQL database server
I wonder if there exist any other technologies used to establish internet connection between
I am using the BLIP/MYNetwork library to establish a basic tcp socket connection between
I'm trying to send/receive data between iOS and OSX via Bluetooth. Because GameKit doesn't
I'm trying to create a two-way communication channel between two programs (one in Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.