使用Gamekit时如何通过WiFi建立连接?

And*_*kha 5 p2p gamekit wifi ios

我想使用GameKit通过WiFi在两个设备之间建立连接.Apple的文档说

如果选择了Internet连接,则应用程序必须关闭对等选择器对话框并显示其自己的用户界面以完成连接.

这就是我做的

- (void)peerPickerController:(GKPeerPickerController *)picker didSelectConnectionType:(GKPeerPickerConnectionType)type
{
if (type == GKPeerPickerConnectionTypeOnline) 
{
    picker.delegate = nil;
    [picker dismiss];
    [picker autorelease];

    [alert setTitle:@"\n\n\n"];
    [alert setMessage:@"Looking for other iPads, iPhones or iPod touches..."];
    [alert addButtonWithTitle:@"Cancel"];

    UIActivityIndicatorView *progress   = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
    progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
    [alert addSubview:progress];
    [progress startAnimating];
    [alert show];
}
}
Run Code Online (Sandbox Code Playgroud)

好的,我已经展示了自己的界面.接下来呢?我如何连接?如何开始寻找同行?

Jam*_*art 2

教程使用 Gamekit 和蓝牙或 WiFi 构建点对点纸牌游戏。(链接已更新)