4 Replies
      Latest reply on Aug 6, 2018 11:25 AM by xaphod
      xaphod Level 1 Level 1 (0 points)

        I'm interested in the new Network.framework that was announced at WWDC18.

        Digging through the docs a bit, in NWInterface.InterfaceType it appears there's no Bluetooth mentioned.

        Does that mean that this framework won't interact with Bluetooth at all (ie. for situations where devices are near each other) ?

        • Re: Network.framework (iOS 12) - no Bluetooth?
          eskimo Apple Staff Apple Staff (9,685 points)

          Does that mean that this framework won't interact with Bluetooth at all … ?

          Ah, um, as of iOS 11 we no longer support peer-to-peer networking over Bluetooth; it’s peer-to-peer Wi-Fi only these days.

          However, you do raise an important point.  Network framework will not use peer-to-peer networking by default; this is the sort of thing that you have to explicitly opt in to (like the includesPeerToPeer property on NSNetService).  However, I just had a look and there doesn’t seem to be a way to opt in to peer-to-peer networking, which is an annoying omission.  Please file an enhancement request for that, and then post your bug number here, 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"

            • Re: Network.framework (iOS 12) - no Bluetooth?
              xaphod Level 1 Level 1 (0 points)

              Thanks Quinn for the response.

               

              I filed "bug" 41099437 for Network.framework (possibly in the wrong place)

               

              Re no longer supporting peer-to-peer networking over Bluetooth in iOS 11, hmm. I am using my own stack that I built ...

              https://github.com/xaphod/Bluepeer

              ... which provides headless P2P over Bluetooth and/or wifi. It uses dns_sd.h via HHServices, which handily does support building P2P Bluetooth networks for me via Bonjour in iOS 11.

              Are you saying that this is a fluke, and might stop working any time? Or is the deprecated stuff only via NSNetService (which I am not using) ?

              It would be a real shame if this suddenly stopped working in iOS 12, because it is a simply KILLER feature: event guests walk up to the photographer's iPad with the app installed, without being on any wifi network, and the app on their iPhone auto-discovers the iPad and allows the guest to take photos via the photographer's iPad (which is likely driving the photographer's big expensive DSLR via ipad's wifi).

              My users love this functionality: they walk up to the iPad, take photos with the photographer's pro setup, and instantly have the photos on their iPhones...

                • Re: Network.framework (iOS 12) - no Bluetooth?
                  eskimo Apple Staff Apple Staff (9,685 points)

                  I filed "bug" 41099437 for Network.framework …

                  Thanks.  It’s definitely made it to the right place.

                  Are you saying that this is a fluke … ?

                  No.  In iOS 11 we disabled peer-to-peer Bluetooth at the NSNetService level (and anything that’s layered on NSNetService, including Multipeer Connectivity).  It has not been removed from the system, and thus is still accessible via <dns_sd.h>.  However, my recommendation is that you not rely on this, and instead making the change to peer-to-peer Wi-Fi.

                  Most folks use NSNetService for this sort of thing, and this change will be transparent to them.  If you’re using <dns_sd.h> it’s somewhat more complex.  The tricky part relates to your listener.  Listening on peer-to-peer Wi-Fi requires that you use one of two APIs:

                  • NSNetService with the NSNetServiceListenForConnections flag

                  • Network framework, once it gets peer-to-peer support

                  Specifically, there is no way to set up a listener that supports peer-to-peer Wi-Fi using low-level APIs like BSD Sockets.

                  My users love this functionality: they walk up to the iPad, take photos with the photographer's pro setup, and instantly have the photos on their iPhones...

                  Right, and that scenario should work just fine over peer-to-peer Wi-Fi, which is the recommendation technology moving forward.

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                    • Re: Network.framework (iOS 12) - no Bluetooth?
                      xaphod Level 1 Level 1 (0 points)

                      Hi Eskimo,

                      I can't move to peer-to-peer wifi, because as I alluded to in my original post (but only in parentheses, sorry), the wifi of the iPad/iPhone is directly connected to a DSLR camera's wifi. That is, it has a 1-1 wifi connection to a Canon/Nikon/etc camera. I did explore Multipeer-like solutions which appear to still facilitate connectivity of other iOS devices while connected to camera, I presume by somehow multiplexing the wifi connectivity. The issue is that the throughput to the camera (vital for live-view) drops to approx 100kB/sec, compared to 1mB/sec which is normal.

                      So for this photobooth app, peer-to-peer Bluetooth is absolutely critical/vital, and I have to rely on dns_sd.h as far as I can see.

                      (that framework of mine that I linked to, BluePeer, does also support peer-to-peer wifi; the photobooth app i'm referring to only uses bluetooth for it)

                       

                      For future apps I write, I certainly won't use dns_sd.h unless they have equally (strict) restrictions ...

                      Makes sense?