Do I need to use the Peer Picker to find peers in the new iPhone SDK 3.0?
I don't really want to use it, but I do want to use the peer-to-peer Bluetooth connection. Is there any sample code that demonstrates the Bluetooth connection without using Peer Picker? The game GKTank that Apple provides uses the Peer Picker, so I can't use that.
Why do you not want to use it?
I don't know there's a way to directly do a bluetooth connection yourself, and it presents an alternative for finding connections by other means. It provides a pretty nice system to set up a network between a number of iPod/Touches, and lets you define if the relation is truly peer or master / slave...
There are two ways to do this.
The first way uses GameKit API. You start by having two separate classes, one that implements the
GKSessionDelegate
protocol and acts as a GameKit/Bluetooth "handler" and the other as the presentation UI (most likely some sort of viewcontroller with a tableview). The way you would wire it up is the handler manages the GameKit notifications etc and then calls delegate methods on the UI to update the table view when a peer connects/drops off, etc. That way, as devices come and go, your picker list should update to show who's around.Below is some code to get you started:
The second way to do it is to use standard Bonjour service selection mechanisms. GameKit is implemented on top of Bonjour (but over Bluetooth instead of WiFi) so once the two sides have gone through network reachability with each other and connected they are registered under Bonjour and act like any Bonjour service would. The GameKit way is probably a little easier, but if you already have code for WiFi it can be reused for Bluetooth as well.