views:

1436

answers:

1

I've read that as of iPhone OS 3.1, GameKit supports wifi connections. But the documentation states:

"If your application configures the peer picker to allow Internet connections, your application must also dismiss the peer picker and present its own interface to configure an internet connection."

Does this still stand? If so, how do I establish a wifi Bonjour session that can be used by GK? (I'm only interested in using the local network.)

+3  A: 

Your GKSession object will automatically handle the discovery of peers over WiFi or Bluetooth, and find those that are available on either protocol.

The documentation is stating that unlike Bluetooth, for which GKPeerPickerController provides a UI to enable Bluetooth if it's not already enabled, GKPeerPickerController does not provide a UI to enable wifi, or select the network the user wishes to be on, you will have to provide your own.

ImHuntingWabbits
Many thanks. So, something like this then: * create GKSession object* show a GKPickerController* the delegate method peerPickerController:didSelectConnectionType: is invoked with GKPeerPickerConnectionTypeOnline* dismiss the GKPickerController and display my own custom picker which uses the same GKConnection to find and display potential peersDoes that sound about right?
Felixyz
Yeah that sounds about right, although you could also try displaying a dialogue from the delegate method, as opposed to dismissing the picker controller. I would dismiss only if absolutely necessary, for example selecting a network could be done easily from an alert box.
ImHuntingWabbits
In Apple documentation dated 2010-06-14: "A GKSession object provides the ability to discover and connect to nearby iPhones using Bluetooth."Not sure it can/will handle auto-discovery of wifi peers.
MrAleGuy