我想使用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];
}
}
好的,我已经展示了自己的界面。接下来呢?我如何连接?如何开始寻找同行?