GameKit giving me a BT status of not available?

I’ve been using GameKit to connect an app together with different iOS devices. Suddenly know when I run the app and I choose to connect by bringing up the GKPeerPickerController, I get this in the console:

  • BTM: attaching to BTServer
  • <<< Session >>> +[GKBluetoothSupport _determineBluetoothStatus]: BT not available – try again later.
  • BTM: posting notification BluetoothAvailabilityChangedNotification

I have no idea why this is happening as BT is enabled on the iOS devices in question. This is using the latest XCode 4 which I was using before without any problems. The code is pretty simple…

-(IBAction) btnConnect:(id) sender {
    picker = [[GKPeerPickerController alloc] init];
    picker.delegate = self;
    picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
    [connect setHidden:YES];
    [disconnect setHidden:NO];
    [picker show];
}

Since I am using the picker I am not declaring a session myself. It should just work, but I get the BT not available error. This is on various iOS devices. I have played with the compiler (which one is being used) to no avail. I am wondering what might cause this behavior because it’s blocking me pretty badly at the moment.

Any ideas?

Update (May 17, 2011 @8:41 AM EDT):

While I still get that strange status, what I did to see if it would still work was this: turn OFF Bluetooth on the iOS device, then ran the application, and of course when the picker is called up and BT is off, you’re prompted to enable BT. When I did that this would be able to connect…

  • BTM: attaching to BTServer
  • <<< Session >>> +[GKBluetoothSupport _determineBluetoothStatus]: BT not available – try again later.
  • BTM: posting notification BluetoothAvailabilityChangedNotification
  • BTM: received BT_LOCAL_DEVICE_POWER_STATE_CHANGED event
  • BTM: posting notification BluetoothPowerChangedNotification
  • BTM: Adding new device 0x192b60 Verizon iPhone 24:AB:81:E3:63:BB 0xf51c0016
  • BTM: _btServiceEventCallback: service = 0x800 eventType = 0 event = 1 result = 0
  • BTM: _btServiceEventCallback: service = 0x800 eventType = 0 event = 11 result = 0
  • BTM: received BT_SERVICE_CONNECTION_RESULT event with 1 currently connected services
  • BTM: posting notification BluetoothDeviceConnectSuccessNotification
  • BTM: received BT_LOCAL_DEVICE_CONNECTION_STATUS_CHANGED event
  • BTM: posting notification BluetoothConnectionStatusChangedNotification

This is at least a work-around even though I have no idea why it’s required all of the sudden.

Related Posts Plugin for WordPress, Blogger...

2 thoughts on “GameKit giving me a BT status of not available?

  1. shinji

    How about this?

    -(GKSession *)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType:(GKPeerPickerConnectionType)type {

    NSString *mySessionID = @”MySessionID”; // unique id between my party
    NSString *myName = nil;

    GKSession *session = [[GKSession alloc] initWithSessionID:mySessionID displayName:myName sessionMode:GKSessionModePeer];
    [session autorelease];
    return session;
    }

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


+ six = 12

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>