MCNearbyServiceBrowser requires WiFi?

Reviving an app I wrote a while back to Swift. When my iPhone X and iPad Air (both on iOS 11.3.1) are both connected to WiFi, the pair of apps work as expected. But when I disable WiFi on one or both, they never connect, even though Bluetooth is enabled.


I have set the appropriate delegates and implemented browser:didNotStartBrowsing: as well as advertiser:didNotStartAdvertisingPeer: (former API in the main app on the iPhone; latter API in the second app on the iPad). But they are never called.


I tried turning off Bluetooth, then back on, but no luck.


Have others been able to use MCNearbyServiceBrowser and correlating APIs in a Bluetooth-only environment?

Accepted Reply

In iOS 11 we disabled peer-to-peer networking over Bluetooth. See this post, and the mailing list post it references, for details.

Share and Enjoy

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

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

Replies

Appears to be an iOS bug (will file one).


This morning, I tried Apple's MultipeerGroupChat sample code. Same results as with my app. Both devices had to be connected to WiFi in order to function. When only bluetooth available, no connection possible.


I then rebooted the iPhone while WiFi was disabled. iPad was stil on WiFi. Running the apps then worked. I then went to the iPad and disabled WiFi. apps failed to work now. Finally, I rebooted the iPad (while WiFi off) and now both apps worked when both have bluetooth.


But... iPhone went to sleep and upon waking it, no connectivity possible again.


So rebooting the devices, but not letting them sleep afterward, is the only way I can get them to connect (both mine and Apple's apps) over Bluetooth.

Out in the field so to speak and all is well with apps connecting over Bluetooth. No reboots required. Device sleep not an issue. Thus, when at home and within the confines of the WiFi network, even with WiFi disabled, then the problems arise. Since this is a personal app not to be sold, this is OK. I will use WiFi when testing at home. But the real world use case is over Bluetooth when away from home.

More testing. I went to a facility with free WiFi where my iPhone remembered the network. At this point, the app connectivity would only work if the iPhone was left on WiFi. I then had the iPhone forget the WiFi network and once again connectivity via Bluetooth works. So if one or both devices are within a known WiFi network, they apps will only connect via WiFi. When WiFi is disabled, the apps will refuse to connect via Bluetooth. If you then physically move outside the WiFi network coverage or have the device forget the WiFi network, then Bluetooth goes back to working. Filed rdar://40001928

In iOS 11 we disabled peer-to-peer networking over Bluetooth. See this post, and the mailing list post it references, for details.

Share and Enjoy

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

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

Ok, my bug report was closed with these same notes. One of my offsite tests was apparantely flawed. I didn't have WiFi disabled on either device, but was outside any WiFi network range. I had thought that was using Bluetooth, but alas it was creating a peer-to-peer WiFi network automatically. Which is great!


Still, will be curious to see how this works in practice when in a very congested location; one of the reasons I liked the tech using Bluetooth.