P2P Bluetooth broken in iOS9.

We have an app that uses peer to peer bluetooth or wi-fi communications. In iOS9 bluetooth connections always fail.


This can be easily demonstrated with the stock WiTap sample app.


To see this install WiTap on two devices with bluetooth enabled. On one of the devices turn wi-fi off to force a bluetooth connection. On that same device turn off Cellular Data for WiTap in iOS settings. Only turn this off for the WiTap app, leave cellular data on for other apps.


When you initiate a connection in WiTap from this device to the other device an NSStreamEventErrorOccurred event with error code 50 (Network is down) occurs in the handleEvent delegate method. This happens every time.


I filed a similar bug report about this earlier this year (20602313) but it also involved trying to access the internet using NSURLSession prior to attempting the P2P connection. Now in iOS 9 it happens all the time.


Anyone else experiencing this?

Replies

This can be easily demonstrated with the stock WiTap sample app.

This sounds like a bug to me. I doubt the root cause is in the WiTap sample itself—it uses the various Bonjour + TCP APIs in the most vanilla way possible—but rather with the way the system handles routing when you’ve disabled WWAN for a specific app. I recommend that you file a bug report about it.

Please post your bug number, just for the record.

Share and Enjoy

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

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

Hi Eskimo,


Thanks for responding. I did file a bug report on this for iOS8 earlier this year #20602313 and updated it last week with this new information. I agree that it's not in WiTap as it also happens in our own app. SimpeNetworkStreams also exhibits this iOS bug. Maybe you can lend your expertese to help solve this 🙂.

I did file a bug report on this for iOS8 earlier this year #20602313

Thanks.

SimpeNetworkStreams also exhibits this iOS bug.

Just FYI, SimpleNetworkStreams doesn’t set

includesPeerToPeer
, nor does it
NSNetServiceListenForConnections
, so I don’t expect it to work peer-to-peer at all.

Share and Enjoy

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

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

Thanks for the info,


For clarification...


When you run SimpleNetworkStreams on a single device with bluetooth on, wi-fi off, and cellular service turned off for app, SimpleNetworkStreams fails with a "Stream Open Error" when you try to send an image. When cellular service is turned on SimpleNetworkStreams works fine.

Is this SimpleNetworkStreams as it ships on the developer web site? If so, that should not work over Bluetooth in any situation because it does not set

includesPeerToPeer
on any of its NSNetService objects.

In addition, SimpleNetworkStreams won’t work over peer-to-peer Wi-Fi because its listeners are implementing using CFSocket, not NSNetService with the

NSNetServiceListenForConnections
option.

Share and Enjoy

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

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

Yes, downloaded from developer.apple.com. Version 1.3.

Could the problem be includesPeerToPeer isn't being handled properly by the lower level networking code?

I can send you a video to demonstrate this...

Could the problem be includesPeerToPeer isn't being handled properly by the lower level networking code?

I thought we’d already established that (-:

I can send you a video to demonstrate this...

I don’t think that’ll be useful. Looking at the big picture, your issue is that Bluetooth peer-to-peer is not working in situations when it should. It won’t help to investigate the phenomenon where it does work when it shouldn’t.

The correct response to your issue is to file a bug that describes the problem with your own app and points to a similar problem in WiTap, which we all consider to be a reference implementation. Which is exactly what you’ve done, right?

Share and Enjoy

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

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