使用Gamekit时如何通过WiFi建立连接? [英] How to make connection over WiFi when working with Gamekit?
本文介绍了使用Gamekit时如何通过WiFi建立连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用GameKit通过WiFi在两个设备之间建立连接.苹果的文档说
I want to make connection between two devices over WiFi using GameKit. Apple's documentation says
如果选择了Internet连接,则您的应用程序必须关闭对等选择器对话框,并显示其自己的用户界面以完成连接.
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];
}
}
好的,我已经介绍了我自己的界面.接下来呢?我该如何连接?如何开始寻找同龄人?
Ok, i have presented my own interface. And what next? How do i connect? How to start looking for peers?
推荐答案
This tutorial builds peer to peer card game using Gamekit and either Bluetooth or wifi. (link updated)
这篇关于使用Gamekit时如何通过WiFi建立连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文