Search Results

Search found 9 results on 1 pages for 'gksession'.

Page 1/1 | 1 

  • GameKit: GKSession manual

    - by mongeta
    Hello, I want to connect two devices using the GKSession, starting one as a server and the other one as a client. Using this configuration I can't use the GKPeerPickerController. I'm having problems for connecting the two devices: Using only bluetooth: impossible using WiFi: at least there are some data exchange between the devices but no successfully conection. In the interface file I have the GKSessionDelegate GKSession *session; In the implementation, I start the server using this code: session = [[GKSession alloc] initWithSessionID:@"iFood" displayName:nil sessionMode:GKSessionModeClient]; session.delegate = self; session.available = YES; The client starts using this code: session = [[GKSession alloc] initWithSessionID:@"iFood" displayName:nil sessionMode:GKSessionModeServer]; session.delegate = self; session.available = YES; How I can force the use of Bluetooth instead of the WiFi ? Also I have implemented those calls: -(void)session:(GKSession *)session didReceiveConnectionRequestFromPeer:(NSString *)peerID { NSLog(@"Someone is trying to connect"); } - (BOOL)acceptConnectionFromPeer:(NSString *)peerID error:(NSError **)error { NSLog(@"acceptConnectionFromPeer"); } When I start, I get this into the debugger: Listening on port 50775 2010-02-19 14:55:02.547 iFood[3009:5103] handleEvents started (2) And when the other device starts to find, I get this: ~ DNSServiceBrowse callback: Ref=187f70, Flags=2, IFIndex=2 (name=[en0]), ErrorType=0 name=00eGs1R1A..Only by Audi regtype=_2c3mugr67ej6j7._udp. domain=local. ~ DNSServiceQueryRecord callback: Ref=17bd40, Flags=2, IFIndex=2 (name=[en0]), ErrorType=0 fullname=00eGs1R1A\.\.Only\032by\032Audi._2c3mugr67ej6j7._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=4500 ** peer 1527211048: oldbusy=0, newbusy=0 ~ DNSServiceBrowse callback: Ref=187f70, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 name=00eGs1R1A..Only by Audi regtype=_2c3mugr67ej6j7._udp. domain=local. GKPeer[186960] 1527211048 service count old=1 new=2 ~ DNSServiceQueryRecord callback: Ref=17bd40, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 fullname=00egs1r1a\.\.only\032by\032audi._2c3mugr67ej6j7._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=7200 ** peer 1527211048: oldbusy=0, newbusy=0 ~ DNSServiceBrowse callback: Ref=187f70, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 name=00TF5kc1A..Only by Audi regtype=_2c3mugr67ej6j7._udp. domain=local. ~ DNSServiceQueryRecord callback: Ref=188320, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 fullname=00tf5kc1a\.\.only\032by\032audi._2c3mugr67ej6j7._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=7200 ** peer 1723356125: oldbusy=0, newbusy=0 ~ DNSServiceQueryRecord callback: Ref=188320, Flags=2, IFIndex=2 (name=[en0]), ErrorType=0 fullname=00TF5kc1A\.\.Only\032by\032Audi._2c3mugr67ej6j7._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=4500 ** peer 1723356125: oldbusy=0, newbusy=0 What I'm missing here ? I'm sure that both devices have bluetooth enabled and connected into the same WiFi. thanks, r.

    Read the article

  • GKSession sendDataToAllPeers including sender?

    - by Typeoneerror
    I've got a number of devices connected over wifi using GameKit. I have a simple UIAlertView popping up when peers receive data. All but the sendee show this alert view when data is sent, so I'm wondering if that's a bug in my app or if that's expected behavior. If the device doing the sending is also a GKSessionModePeer, I would expect it to "fire" its receiveData: message as well since I'm sending to all peers. Should I call a method manually at the same on the sendee device? For example, if I wanted to send a "GameStart" packet to the 4 phones, the peers would call startGame: in the receiveData:fromPeer:inSession:context: method when it receives that packet and the sendee would be calling sendDataToAllPeers: and call startGame: on itself. Does that sound right or is there a way to include the sendee in the sendDataToAllPeers: list so that it responds exactly the same as all connected peers?

    Read the article

  • GKSession sendDataToAllPeers including sendee?

    - by Typeoneerror
    I've got a number of devices connected over wifi using GameKit. I have a simple UIAlertView popping up when peers receive data. All but the sendee show this alert view when data is sent, so I'm wondering if that's a bug in my app or if that's expected behavior. Should call a method manually at the same on the sendee device? For example, if I wanted to send a "GameStart" packet to the 4 phones, the peers would call startGame: in the receiveData:fromPeer:inSession:context: method when it receives that packet and the sendee would just sendData and call startGame: on itself. Does that sound right or is there a way to include the sendee in the sendData list so that it responds exactly the same as all connected peers?

    Read the article

  • GKSession sendDataToAllPeers getting invalid parameter

    - by cb4
    This is my first post and I wanted to start it by thanking the many stackoverflow contributors who will never know how much they helped me out these past several days as I worked to complete my first iOS app. I am indebted to them and to this site for giving them a place to post. To 'pay off' some of that debt, I hope this will help others as I have been helped... So, my app uses the GKPeerPickerController to make a connection to a 2nd device. Once connected, the devices can send text messages to each other. The receiving peer has the message displayed in a UIAlertView. Everything was working fine. Then I decided to experiment with locations and added code to get the current location. I convert it into latitude & longitude in degrees, minutes, and seconds and put them into one NSString. I added a button to my storyboard called 'Send Location' which, when tapped, sends the location to the connected peer. This is where I ran into the problem. Both the send text and send location methods call the sendPacket method with a NSString. sendPacket converts the string to NSData and calls sendDataToAllPeers. When I learned how to capture the error, it was "Invalid parameter for - sendDataToAllPeers:withDataMode:error:". [.....pause.....] Well, this was going to be a question but in writing all this to explain the problem, the answer just dawned on me. Did a few tests and verified it now works. The issue was not in sendDataToAllPeers, it was in the conversion of the NSString (strToSend) to NSData: packet = [strToSend dataUsingEncoding:NSASCIIStringEncoding]; Specifically, it was the degree sign character (little circle, ASCII 176). NSASCIIStringEncoding only includes ASCII characters up to 127 so don't use any above that. I'm sure there was a quicker way to find the problem, but I don't know Objective-C or Xcode's debugging facility well enough yet. Whew! Several hours to discover that little tidbit. I did learn a lot, though, and that's always a good thing!

    Read the article

  • GKTank example is not working.

    - by david
    Hello, I'm trying to get the GKTank example working with 2 iPhones. Both have bluetooth enabled. I start the app on both devices and tap the screen. The Peer Picker comes up and the devices find each other. If I select one device in the list it says "Waiting for {other iPhone}..." forever. On the {other iPhone} the waiting phone gets grayed out. If I select the device to connect to from both devices at the same time both go into waiting state forever... The debug log says this if I select the other iPhone on the debugged device: 2010-05-30 23:20:24.331 GKTank[2433:4e03] handleEvents started (2) 2010-05-30 23:20:25.269 GKTank[2433:4e03] ~ DNSServiceRegister callback: Ref=135f70, Flags=2, ErrorType=0 name=00oRWv-0A..David’s iPhone regtype=_gktank._udp. domain=local. 2010-05-30 23:20:25.375 GKTank[2433:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=2, IFIndex=8 (name=[en2]), ErrorType=0 name=00oRWv-0A..David’s iPhone regtype=_gktank._udp. domain=local. 2010-05-30 23:20:30.691 GKTank[2433:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 name=00K83eS0A..iPhone von Tamara regtype=_gktank._udp. domain=local. 2010-05-30 23:20:30.855 GKTank[2433:4e03] ~ DNSServiceQueryRecord callback: Ref=13a320, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 fullname=00k83es0a..iphone\032von\032tamara._gktank._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=7200 2010-05-30 23:20:30.872 GKTank[2433:4e03] ** peer 480260628: oldbusy=0, newbusy=0 2010-05-30 23:20:35.215 GKTank[2433:207] ** Stop resolving? potentially previous resolves 2010-05-30 23:20:35.226 GKTank[2433:207] **** BEGIN RESOLVE: 480260628 and it stays that way. On the second iPhone the device is listed as not available and grayed out. If I select each other at the same time it says this: 2010-05-30 23:24:31.416 GKTank[2442:4e03] handleEvents started (2) 2010-05-30 23:24:32.321 GKTank[2442:4e03] ~ DNSServiceRegister callback: Ref=135120, Flags=2, ErrorType=0 name=006JiAZ0A..David’s iPhone regtype=_gktank._udp. domain=local. 2010-05-30 23:24:32.419 GKTank[2442:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=2, IFIndex=8 (name=[en2]), ErrorType=0 name=006JiAZ0A..David’s iPhone regtype=_gktank._udp. domain=local. 2010-05-30 23:24:57.156 GKTank[2442:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 name=004_n6C0A..iPhone von Tamara regtype=_gktank._udp. domain=local. 2010-05-30 23:24:57.308 GKTank[2442:4e03] ~ DNSServiceQueryRecord callback: Ref=13a320, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 fullname=004_n6c0a..iphone\032von\032tamara._gktank._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=7200 2010-05-30 23:24:57.314 GKTank[2442:4e03] ** peer 203104196: oldbusy=0, newbusy=0 2010-05-30 23:25:02.383 GKTank[2442:207] ** Stop resolving? potentially previous resolves 2010-05-30 23:25:02.425 GKTank[2442:207] **** BEGIN RESOLVE: 203104196 2010-05-30 23:25:13.562 GKTank[2442:4e03] ~ DNSServiceQueryRecord callback: Ref=13a320, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 fullname=004_n6c0a..iphone\032von\032tamara._gktank._udp.local. rrtype=16 rrclass=1 rdlen=18 ttl=7200 2010-05-30 23:25:13.569 GKTank[2442:4e03] ** peer 203104196: oldbusy=0, newbusy=1 2010-05-30 23:25:33.660 GKTank[2442:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=0, IFIndex=-3 (name=[]), ErrorType=0 name=004_n6C0A..iPhone von Tamara regtype=_gktank._udp. domain=local. 2010-05-30 23:25:33.671 GKTank[2442:4e03] Peer [203104196] removed? (0). 2010-05-30 23:25:33.683 GKTank[2442:4e03] GKPeer[139f10] 203104196 service count old=1 new=0 2010-05-30 23:25:37.786 GKTank[2442:4e03] ~ DNSServiceBrowse callback: Ref=134f30, Flags=2, IFIndex=-3 (name=[]), ErrorType=0 name=004_n6C0A..iPhone von Tamara regtype=_gktank._udp. domain=local. 2010-05-30 23:25:37.816 GKTank[2442:4e03] GKPeer[139f10] 203104196 service count old=0 new=1 ... and waits forever. Does anybody know whats wrong with this sample??

    Read the article

  • How to specify Wireless or Bluetooth in GameKit when using my own custom interface

    - by DonnaLea
    Hi, I've decided to implement my own interface for connecting two devices running my game, as opposed to using the GKPeerPickerController. This is actually working quite well. But I just realised that in my creating of the GKSession I'm not actually specifying whether the connection should be Wireless or Bluetooth. I have an option in my interface to let the user specify which connection method they'd like to use. How do I tell GKSession whether I want it to connect via Bluetooth or Wireless? I think what is currently happening is that it defaults to Wireless if wireless is enabled otherwise it uses Bluetooth. But I'd like to let the user specify which connection method, is this possible? Thanks, Donna

    Read the article

  • GKPeerStateAvailable for non existing peers?

    - by Ernest
    Hi, used this website for the long time to find answers, now need to ask on myself! :) I have implemented multi player for my game using GKSession and client/server approach, not using peer picker (up to 4 player allowed). I have one big problem which I can't find solution for. If you disconnect/reconnect server peer quickly enough, client peer will "remember" that host and will show it in the list of all available peers permanently, only turning wifi/bluetooth off resets this. So if I do this 5 times in a row, my client will show 5 available hosts with the same name! Anyone had experience with this? Any idea of workarounds? I should note that requirements for my game is iPhone SDK 3.0 for Bluetooth and 3.1 for Wifi as GKSession supports both now.

    Read the article

  • Getting list of bluetooth devices nearby on iphone sdk

    - by Michael Cindric
    Hi Guys, I need to be able to search for all bluetooth devices nearby and just get there ids. I don't need to pair at all. I am using iphone 2.3 beta. Is this possible l have tried using GameKit and no luck does anyone know how to do this. BOOL result = NO; if (!session) { session = [[GKSession alloc] initWithSessionID:@"SCANNER" displayName:nil sessionMode:GKSessionModePeer]; self.session.delegate = self; [self.session setDataReceiveHandler:self withContext:nil]; self.session.available = YES; result = YES; } it dies on [self.session setDataReceiveHandler:self withContext:nil]; with the following error Scanner[42754:207] Error: 30500 -- Invalid parameter for -setDataReceiveHandler:withContext:. then ~ DNSServiceRegister callback: Ref=471fa40, Flags=2, ErrorType=0 name=00rusor1A..iPhone Simulator regtype=_q1eu29voete9jf._udp. domain=local.

    Read the article

  • How to get a UIAlertView's result??

    - by cocos2dbeginner
    Hi, I implemented the gamekit. All works fine now. But if the user presses on send the data will instantly send to the other iphone/ipod/ipad and it will instantly written. So now i wanted to implemenr a confirm screen for the receiver. In my receiveData method (from the gamekit) i have an array. If the user presses yes the array will be written into a file.if not it wont be written into a file. #pragma mark - #pragma mark - GKreceiveData - (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession: (GKSession *)session context:(void *)context { NSDictionary *dict = [NSKeyedUnarchiver unarchiveObjectWithData:data]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Incoming Set" message:[NSString stringWithFormat:@"%@ wants to send you a Set named: \n\n %@",[session displayNameForPeer:peer], [dict valueForKey:@"SetName"]] delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; [alert show]; [alert release]; } - (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { // the user clicked one of the OK/Cancel buttons if (buttonIndex == 0) { //NSLog(@"ok"); //this should happen if the user presses on ok on the alertview. [dataArray addObject:dict]; //i can't acess "dict" } else { //NSLog(@"cancel"); } } Do you see the problem?? What can I do??

    Read the article

1