Bluetooth over GKSession or MultipeerConnectivity on iOS 9

GKSession has stopped to work over Bluetooth connections on iOS 9. It still works fine when connecting devices are attached to the same WLAN. When their WLAN connectivity is switched off or they are on different WLANs, however, something goes wrong. The devices still seem to find each other:

  • the client switches to GKPeerStateAvailable and get's the server's name, and
  • the server's console shows a message 'BTM: connection to service 0x00000800 on device "PDA" [MAC address] succeeded' with the client's MAC address).

However, when the client tries to connect, it immediately (within 100ms) receives a failure callback with error 30505 (Failed while pending outgoing invitation). I observed this behavior whenever at least one of the devices runs iOS 9.0 or iOS 9.0.1.


Now I know that GKSession is deprecated and that I will eventually have to bite the bullet and switch to its MultipeerConnectivity successor, MCSession. I did some experiments with MCSession before and know that it is not a big hero on stability, either. So before I switch, can anybody with iOS 9 experience on MultipeerConnectivity answer at least one of the following questions:

  1. Does MCSession show similar issues with Bluetooth since iOS 9?
  2. Can MCSession and GKMatch coexist (i.e. be active at the same time) on the same device (as GKSession and GKMatch do)?
  3. Does anybody still use Bluetooth succesfully with GKSession in iOS 9?
  4. Can GKSession and MCSession on different devices connect to each other?
  5. Can GKSession and MCSession coexist on the same device?
  6. Is this Bluetooth issue a bug in GKSession that might still get fixed or a first step to switch it off completely?

Accepted Reply

I might file a bug report …

Obviously I can’t stop you from filing a bug but I wouldn’t get your hopes up here. GKSession has been deprecated for three OS releases now (iOS 7 through 9). It’s time to move on.

Also, keep in mind that engineering resources within Apple are constrained in the same way that they are everywhere else. The folks working on Multipeer Connectivity are the same folks who would fix your GKSession bug. And if I had my choice, I’d rather have those folks working to make Multipeer Connectivity better than reanimating the corpse of GKSession (-;

To answer your specific questions:

Does MCSession show similar issues with Bluetooth since iOS 9?

I’ve not seen any reports of that.

Can MCSession and GKMatch coexist (i.e. be active at the same time) on the same device (as GKSession and GKMatch do)?

Yes (subject to the usual coexistence caveats related to Bluetooth, Wi-Fi, and peer-to-peer Wi-Fi).

Does anybody still use Bluetooth succesfully with GKSession in iOS 9?

I’m going to skip this one.

Can GKSession and MCSession on different devices connect to each other?

No. GKSession and MCSession use different protocols that do not interoperate.

Can GKSession and MCSession coexist on the same device?

Yes (with the same coexistence caveat).

Is this Bluetooth issue a bug in GKSession that might still get fixed or a first step to switch it off completely?

IMO it’s time to move away from GKSession.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

I chased this issue all day yesterday, with no solutions in place. GKSession simply won't work over BT on iOS 9, and immediately throws an error exactly as you've described.


I have made the switch to Multipeer Connectivity, but we maintain the older GameKit networking mode to interact with older hardware that can't run the latest iOS. Is this the end of that? If so, it surprises me that GK networking still technically works, just not over BT.


For your specific questions, I may be able to help:


1) Our MC based code isn't having any problems from what we've seen so far.

2) I don't use GKMatch, so I can't answer that for you.

3) Not me.

4) No.

5) Yes. I don't think they can be active at the same time, though, as we switch 'modes' in our app so they are mutually exclusive.

6) Apple will have to answer that, and the sooner the better for me!

Hi KeetoNet,


Thanks for your quick reply. I have wasted most of yesterday on this issue as well, I am relieved to see that it is not just my app that is broken. About 6), it does smell like a bug, particularly since the underlying Bonjour connection seems to work on the Bluetooth layer and just fails when connecting in GKSession, and since GKSession works flawlessly on WLAN.


I might file a bug report, though I was disappointed in the past on Apple's inactivity for bugs concerning older technology. I hope they don't just let GKSession slowly rot away.

I might file a bug report …

Obviously I can’t stop you from filing a bug but I wouldn’t get your hopes up here. GKSession has been deprecated for three OS releases now (iOS 7 through 9). It’s time to move on.

Also, keep in mind that engineering resources within Apple are constrained in the same way that they are everywhere else. The folks working on Multipeer Connectivity are the same folks who would fix your GKSession bug. And if I had my choice, I’d rather have those folks working to make Multipeer Connectivity better than reanimating the corpse of GKSession (-;

To answer your specific questions:

Does MCSession show similar issues with Bluetooth since iOS 9?

I’ve not seen any reports of that.

Can MCSession and GKMatch coexist (i.e. be active at the same time) on the same device (as GKSession and GKMatch do)?

Yes (subject to the usual coexistence caveats related to Bluetooth, Wi-Fi, and peer-to-peer Wi-Fi).

Does anybody still use Bluetooth succesfully with GKSession in iOS 9?

I’m going to skip this one.

Can GKSession and MCSession on different devices connect to each other?

No. GKSession and MCSession use different protocols that do not interoperate.

Can GKSession and MCSession coexist on the same device?

Yes (with the same coexistence caveat).

Is this Bluetooth issue a bug in GKSession that might still get fixed or a first step to switch it off completely?

IMO it’s time to move away from GKSession.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your candid no on the bugfixing prospects.

Well, that's the end of our legacy device support then. Thanks for a definitive answer.

I'm actually seeing this behavior using MPC but only in the iPhone. iPods and iPads do not seem to be impacted. Details: my app has been available for about 3 years. Used to be on GK but converted to MPC last year. No issues until ios 9. On the iPad and iPhone, I turn off wifi and turn on Bluetooth. This forces a Bluetooth connection. My devices see each other and try to connect but time out. Workaround: I have to enable both wifi and Bluetooth on the iPhone (still Bluetooth only on the iPad) and the connection works as it always did over Bluetooth. Again, iPods do not seem to have an issue. I do not see any issues using wifi only.

I've been working on updating an oldish app recently, including replacing our usage of GKSession with MCSession. After some work we got MCSession working, but Bluetooth connections established in this way have a painfully slow ping. (>1 second.) Unusable for a real-time game. We also found the connection process to be slower and more finicky than what we had with GKSession.

So... after a month of living with and testing our new MCSession code, we're reverting to our old, deprecated GKSession code. We figure that not establiishing a connection over bluetooth is better than establishing a bad one. (The user won't realize why it's so slow.) Kinda sad that we felt reverting to an old, deprecated API worked better than Apple's currently supported / recommended one.

Anyone else seeing this? (ie. very slow ping over MCSession bluetooth connections.)