Is it possible to connect to more than 1 devices using the new GameKit framework? Till now all the examples I've seen show how we can connect to 1 device. Even the default connection interface lets the user select just one connect.
Thanks.
The official list of current iOS Wi-Fi Management APIs. There is no Wi-Fi Direct type of connection available. The primary issue being that Apple does not allow programmatic setting of the Wi-Fi network SSID and password.
Here, the app uses Apple's Multipeer Connectivity framework, essentially a peer-to-peer feature that lets you share messages (and soon photos) with other app users nearby, regardless of whether you have an actual Wi-Fi or cellular connection.
There's a fairly good overview here at the following link of how to configure and use GameKit for your App.
Unfortunately, you will not be able to use the GKPeerPickerController standard UI picker to configure the GKSession instance for you if you want to support more than 2 devices. Instead, you must develop your own UI elements to setup and configure the connections between the master/server and the multiple clients.
Here's a simple way to enable GameKit for more than 2 devices:
When you initialize a GKSession instance with initWithSessionID:displayName:sessionMode, use:
sessionMode:GKSessionModePeer is the 3rd available option and is the option used in most sample code provided by Apple such as the GKTank demo.
Note: You can probably use GKSessionModePeer and still have a network of more than 2 devices since peer mode puts the device in server and client mode at the same time until a connection is made. Explicitly configuring one device as the server may simplify the setup which is useful for testing the GameKit API.
For the server:
GKSession *session = [[GKSession alloc] initWithSessionID:kTestSessionID displayName:nil sessionMode:GKSessionModeServer];
For the client(s):
GKSession *session = [[GKSession alloc] initWithSessionID:kTestSessionID displayName:nil sessionMode:GKSessionModeClient];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With