| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/GameKit.framework |
| Availability | Available in iPhone OS 3.0 and later. |
| Companion guide | |
| Declared in | GKPeerPickerController.h |
| Related sample code |
The GKPeerPickerController class provides a standard user interface to allow an iPhone to discover and connect to another iPhone. The result is a configured GKSession object connecting the two devices. To use a GKPeerPickerController object, your application creates the controller, adds a delegate, configures the allowed connection types, and then shows the peer picker. The delegate is called as the user makes selections within the peer picker interface.
In iPhone OS 3.0, the peer picker can be configured to select between Bluetooth and Internet connections.
Important: Although users can select internet connections in the peer picker, the GKPeerPickerController does not provide an user interface to configure them. 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.
delegate property
connectionTypesMask property
For more about Objective-C properties, see “Properties” in The Objective-C Programming Language.
A mask that determines the types of connections a dialog presents to the user.
@property(nonatomic, assign) GKPeerPickerConnectionType connectionTypesMask
Your application configures the connection types it allows before showing the peer picker. If your application allows more than one connection type, the peer picker offers the user a choice of which type of connection to use. The default value for the mask is GKPeerPickerConnectionTypeNearby.
Important: In iPhone OS 3.0, GKPeerPickerConnectionTypeNearby is required to be one of the allowed connection types. An exception is thrown if your application does not include it.
GKPeerPickerController.hThe delegate of the peer picker controller.
@property(nonatomic, assign) id<GKPeerPickerControllerDelegate> delegate
The delegate must adopt the GKPeerPickerControllerDelegate formal protocol.
GKPeerPickerController.hA Boolean value that indicates whether the picker dialog is visible. (read-only)
@property(readonly, getter=isVisible) BOOL visible
GKPeerPickerController.hHides the peer picker dialog.
- (void)dismiss
The controller’s delegate is responsible for dismissing the peer picker when it is no longer needed.
GKPeerPickerController.hDisplays the peer picker dialog to the user.
- (void)show
GKPeerPickerController.hNetwork connections available to the peer picker dialog.
enum {
GKPeerPickerConnectionTypeOnline = 1 << 0,
GKPeerPickerConnectionTypeNearby = 1 << 1
};
typedef NSUInteger GKPeerPickerConnectionType;
Last updated: 2009-05-26