Is NSNetService between a Mac and iOS device over Bluetooth only (WiFi off) possible?

I'm trying to sort out the system/hardward requirements for using Bonjour/NSNetService to connect an iPhone to a Mac.


Are these combinations possible:


  1. [?] Bluetooth ON, WiFi OFF on Mac and iPhone
  2. [?] Bluetooth OFF, WiFi ON on Mac and iPhone, but both devices are not part of any WiFi network (i.e. no router present)
  3. [✓ Works] Bluetooth OFF, WiFi On, Mac and iPhone part of the same WiFi network


I got a Bluetooth-only NSNetService up and running between an iPhone and an iPad, but never with a Mac (MacBook Pro mid-2012). Is this a hardware issue or is it not possible to connect an iPhone and a Mac through Bluetooth alone?


Thanks!


PS: I set includesPeerToPeer = true for the service and browser. My code is based on the WiTap sample code.

Answered by DTS Engineer in 116201022

The current situation is:

  • peer-to-peer Bluetooth

    • OS X — not supported

    • iOS — all relevant hardware and software releases

    • watchOS — not applicable

    • tvOS — not supported

  • peer-to-peer Wi-Fi

    • OS X — OS X 10.10 and later on relatively modern hardware (circa 2012 or later)

    • iOS — iOS 7.0 and later on all devices with a Lightning connector (it’s not tied to the Lightning hardware, it’s just a helpful coincidence)

    • watchOS — not applicable

    • tvOS — not working

Note:

  • watchOS does not support direct TCP connections (things like BSD Sockets and NSStream) for third-party apps, which makes the situation with peer-to-peer network interfaces irrelevant.

  • tvOS should support peer-to-peer Wi-Fi but the support is not functioning reliably right now (r. 24713937, r. 24713970).

Share and Enjoy

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

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

(r. 27821801)

Accepted Answer

The current situation is:

  • peer-to-peer Bluetooth

    • OS X — not supported

    • iOS — all relevant hardware and software releases

    • watchOS — not applicable

    • tvOS — not supported

  • peer-to-peer Wi-Fi

    • OS X — OS X 10.10 and later on relatively modern hardware (circa 2012 or later)

    • iOS — iOS 7.0 and later on all devices with a Lightning connector (it’s not tied to the Lightning hardware, it’s just a helpful coincidence)

    • watchOS — not applicable

    • tvOS — not working

Note:

  • watchOS does not support direct TCP connections (things like BSD Sockets and NSStream) for third-party apps, which makes the situation with peer-to-peer network interfaces irrelevant.

  • tvOS should support peer-to-peer Wi-Fi but the support is not functioning reliably right now (r. 24713937, r. 24713970).

Share and Enjoy

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

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

(r. 27821801)

Awesome, thanks a lot!!!

Is there a known workaround for tvOS wifi peer-to-peer not functioning reliably (or issues r. 24,713,937, r. 24,713,970 assuming they're the same thing)? We're communicating via sockets, so I'm hoping there's an easy workaround.


iOS and tvOS can discover each other and resolve their addresses, but when connecting it times out on the connect() function. It would be great to know if there's a solution in the meantime.

Dear Quinn, given that on tvOS 10 Multipeer Connectivity is now supported, does that mean that p2p bluetooth / wifi on tvOS 10 now should work?

Hello Quinn,


Can you please verify that P2P bluetooth still works in iOS 11? We cannot get it to work in our app or with WiTap! The remote device is never discovered.


(wi-fi direct does work however)


Thanks.

Can you please verify that P2P bluetooth still works in iOS 11?

It does not. This recently came up on the bonjour-dev mailing list. This post is the crux of it but the entire (relatively short) thread is worth reading.

ps That link is now broken so I’ve added a copy of the relevant bits in the following text attachment.



Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for your response. It's too bad this decision was made. There are still quite a bit of older devices that don't support wi-fi direct and use bluetooth for peer to peer connections.


Does the DNS-SD API support wi-fi direct? Last year in a post you mentioned that the only way to get peer to peer wi-fi is with NSNetService. We have been unable to get this working using the DNS-SD apis.


Thanks for your help.

Does the DNS-SD API support wi-fi direct?

To be clear, Apple’s Bonjour-based peer-to-peer Wi-Fi is not Wi-Fi Direct. They are very different beasts.

Last year in a post you mentioned that the only way to get peer to peer wi-fi is with NSNetService.

As far I know that’s still the case.

Share and Enjoy

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

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

Well, disabling P2P over Bluetooth will break connectivity when one iOS device is using another device's Personal Hotspot. At least it does at the moment (iOS 12). Is there anything that can be done on our end to solve that or it's just a result the deprecating connectivity via Bluetooth?


This is dissapointing as our app relied on Bluetooth in this particular use case...

Is NSNetService between a Mac and iOS device over Bluetooth only (WiFi off) possible?
 
 
Q