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?
This tutorial builds peer to peer card game using Gamekit and either Bluetooth or wifi. (link updated)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With