Presenting a Peer Picker

We will begin, as we have in the past, by adding a new button for our Peer Picker in our UFOViewController.xib, as shown in Figure 6–4. Create a new action for the button and name it localMultiplayerGameButtonPressed. In addition, you need to create two new class variables, one instance of GKPeerPickerController and another for a GKSession. Name these peerPickerController and currentSession, respectively. You also need to conform the UFOViewController to the delegate GKPeerPickerControllerDelegate.


Figure 6–4. Adding a button for a local multiplayer game

Add the following code to the action that you created for the ...

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.