问题
I want to make connection between two devices over WiFi using GameKit. Apple's documentation says
If an Internet connection is chosen, your application must dismiss the peer picker dialog and present its own user interface to complete the connection.
This is what i do
- (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?
回答1:
This tutorial builds peer to peer card game using Gamekit and either Bluetooth or wifi. (link updated)
来源:https://stackoverflow.com/questions/10862670/how-to-make-connection-over-wifi-when-working-with-gamekit