Gamekit how to do p2p wifi connection in iphone

回眸只為那壹抹淺笑 提交于 2019-12-04 19:28:17
rougeExciter

Hassan’s answer is wrong.

GameKit’s peer-to-peer model can be used in two ways. The Bluetooth classes (that work with PeerPicker, etc.) basically implement Bonjour over Bluetooth. However, if you want to support Wi-Fi and Bluetooth the best thing to do is have a Bonjour based “framework” for establishing the connections, but feed it either from the standard Bonjour services (for Wi-Fi) or from those established by GameKit over Bluetooth.

This post provides some good pointers, but in essence, you will need to use Bonjour to establish your Wi-Fi peer-to-peer connection.

GameKit in iPhone SDK 3.0

add the following method in your code

    - (void)peerPickerController:(GKPeerPickerController *)picker didSelectConnectionType:(GKPeerPickerConnectionType)type
{

picker.connectionTypesMask =  GKPeerPickerConnectionTypeOnline;

}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!