我想使用 GameKit 通过 WiFi 在两个设备之间建立连接。苹果的文件说
如果选择了 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];
}
}
好的,我已经展示了我自己的界面。接下来呢?我如何连接?如何开始寻找同行?