我想使用 GameKit 通过 WiFi 在两个设备之间建立连接。苹果的文档说
If an Internet connection is chosen, your application must dismiss the peer picker dialog and present its own user interface to complete the connection.
我就是这样做的
- (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];
}
}
好的,我已经展示了我自己的界面。接下来呢?我如何连接?如何开始寻找同行?
最佳答案
这tutorial使用 Gamekit 和蓝牙或 wifi 构建点对点纸牌游戏。 (链接已更新)
关于ios - 使用 Gamekit 时如何通过 WiFi 建立连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10862670/