Apple itself has demos that show Wi-Fi connections using GKSession and Bluetooth using GKPeerPickerController. If you need a peerPicker and an option for both, I think you need to use a peerpicker controller to give the user a choice. Use this code where you want the collector to appear after you instantiate the collector.
picker.connectionTypesMask = GKPeerPickerConnectionTypeOnline | GKPeerPickerConnectionTypeNearby;
Then, if they choose wifi, use the code from the GKRocket project in the iOS sample code library. If they choose Bluetooth, then use GKTank.
GKRocket code (using GKSession and tables) is much more complicated, but GKSession automatically uses bluetooth if there is no wifi coverage. Given that you will need most of the GKSession code in your project for working with Wi-Fi, I think it’s easier to forget about peerPickerController if you don't want only Bluetooth.
In the end, Apple will definitely add the necessary methods and properties of peerPickerController to handle Wi-Fi, but at the moment this is the GKSession you need.
Hope this helps.
source share