5 Replies
      Latest reply on Sep 5, 2017 6:27 AM by eskimo
      cdescours_eco Level 1 Level 1 (0 points)

        Dear,

         

        We're currently working on an iOS app which needs to pair to a custom external device (smart camera) to work correctly. The pairing mechanism is currently based on WebSockets, so the app and the camera needs to be on the same network to be discovered and work correctly.

        For information, the smart camera rely on a Raspberry Pi 3.


        For now, when both the app and the smart camera are on the same WiFi network, the pairing works, and everything work as expected. Nonetheless, the app needs to work even if it is not connected to an external WiFi network. So we thought we could use the iOS' Personal Hotspot to connect the smart camera to, so as to enable the pairing (since it would then be on the same network).


        But, we're currently encountering a problem, after enabling Personal Hotspot from iOS, the camera either :

        1. does not "see" the WiFi Network, so it can't connect to it
        2. when the network is visible, it does not connect to the personal Hotspot : it keeps trying to negotiate keys, and authenticating without success

        When this problem occurs, we also tried to connect a Windows 7 laptop and a MacBookPro (running latest Sierra), but the WiFi connexion to iOS' Personal Hotspot could not been established either, with similar behaviors (wifi visibility, impossible to authenticate, connexion stabiliy...). So the problem does not seem to come with some network configuration on external devices, but more on the Personal Hotspot feature.


        We've tried to test the Personal Hotspot on several iOS devices (iPhones 5, 5S, 6, 6+, 6S, SE, 7, 7+ both running latest iOS 10 version), and with no explanation, it only worked when the iPhone SE shared its connexion (?!?)...


        We're quite stuck on this, since iOS does not give much settings/information on Personal Hotspot, and it is a user-level feature, with no API to control it.

        What we've come to with some WiFi tools, it seems that iOS uses WPA2 Personal algorithm for securing its Personal Hotspot, but any additional information might be useful for us...

         

        For the moment, we have already tried :

        • to rename iPhone to remove any space and/or special characters
        • use a very simple password with no spaces and/or special characters
        • encode WiFi name in a base64 string on the Raspberry 3


        Any help or similar problem/experience from others people will be much appreciated, because this feature is critical for us, and a core to our business.


        Thanks in advance for your help,

        Regards,

        • Re: Can't connect devices to iOS Personal Hotspot
          eskimo Apple Staff Apple Staff (12,475 points)

          There’s two parts to this issue:

          • Connecting devices to Personal Hotspot

          • Your overall strategy for your app

          I don’t have a lot of input on the first part.  It’s essentially a user-level issue and such issues are supported by AppleCare.  You might have better luck asking this question over in AppleCare’s Apple Support Communities, where you’re more likely to find folks with Personal Hotspot experience.

          With regards the second part, I have serious concerns about your strategy, ones that I’ve expressed before here on DevForums.

          Share and Enjoy

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

            • Re: Can't connect devices to iOS Personal Hotspot
              cdescours_eco Level 1 Level 1 (0 points)

              "Dear eskimo,

               

              Thanks for your considering my question.


              For information, we have already contacted Apple Support by phone to ask about Personal Hotspot feature in a user-level way, but their answer was not very useful, since they would only tell us to update the device to the latest iOS version, and try to restart it, and reenable the Personal Hotspot... In a way quite that was already described in this article https://support.apple.com/en-us/HT203302


              For the second part, I followed the link you provided, and you mention that "Personal Hotspot was designed solely as a way to connect the client devices to the Internet". Correct me if I'm wrong I might be misunderstand what you're telling, but if a client (in my case a smart camera) is connected to Internet through the iPhone, then it is then on the same network as the iPhone, and the latter can "discuss" with the client over an IP, does it ?


              I've finally obtained the iPhone logs during pairing of the smart camera :

              sharingd
              Updated tethering support result = YES, wifiResult = YES, netRBResult = YES, firstUnlocked = YES
              sharingd
              state = 1023, reason = 0
              sharingd
              connected hosts = 1, only usb = NO, flipped switch on = NO, wifiClient = <WiFiManagerClient 0x101d2e630 [0x1b3994240]>, discovery state = YES, hostAPNetwork = YES, network timer = (null)
              locationd
              WifiMgr, error, bssid invalid, <private>, #CloneMe
              locationd
              WifiMgr, error, bssid invalid, <private>, #CloneMe
              CommCenter
              #I Calling _CTGetCellularDataIsEnabled()
              analyticsd
              [<private>] no observers; dropped.
              symptomsd
              SCDynamicStore config_callback: k: com.apple.MobileInternetSharing
              symptomsd
              SCDynamicStore key: com.apple.MobileInternetSharing, interfaces: {}
              hostapd
              STA d4:7b:b0:8:37:a associated
              hostapd
              STA d4:7b:b0:08:37:0a event 1 notification
              hostapd
              STA d4:7b:b0:08:37:0a start authentication
              hostapd
              STA d4:7b:b0:8:37:a DEAUTHORIZED.
              hostapd
              STA d4:7b:b0:08:37:0a sending 1/4 msg of 4-Way Handshake
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 C9 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BF EF 92 FF 9E FF A2 01 00 32 A4 03 00 01 32 00']
              hostapd
              STA d4:7b:b0:08:37:0a received EAPOL-Key frame (2/4 Pairwise)
              hostapd
              STA d4:7b:b0:08:37:0a MIC OK
              hostapd
              STA d4:7b:b0:08:37:0a sending 3/4 msg of 4-Way Handshake
              CommCenter
              QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CA 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BB EE 94 FF 7C FF A2 01 00 32 A4 03 00 01 32 00']
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CB 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B8 EC 94 FF B6 FF A2 01 00 32 A4 03 00 01 32 00']
              CommCenter
              QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CC 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B7 EC 96 FF C0 FF A2 01 00 32 A4 03 00 01 32 00']
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CD 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 B4 ED 94 FF DA FF A2 01 00 32 A4 03 00 01 32 00']
              CommCenter
              QMI: Svc=0xe2(BSP) Req MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0xe2(BSP) Resp MsgId=0xe002 Bin=[<private>]
              CommCenter
              QMI: Svc=0x03(NAS) Ind MsgId=0x0051 Bin=['01 2A 00 80 03 05 04 CE 39 51 00 1E 00 11 08 00 83 05 00 00 96 FF FF FF 14 06 00 BC EF 93 FF 86 FF A2 01 00 32 A4 03 00 01 32 00']
              CommCenter
              #I Data usage threshold reached for tethering, bytes consumed: 110254 total consumed:: 730740
              CommCenter
              #I Cumulative bytes at threshold: 61045158, Previous value: 59016742, Delta: 2028416
              CommCenter
              Threshold reached when entity: (uuid: <private> euuid: <private> pid: 4120 epid: 4120 process: <private> bundle id: <private>) consumed: (889770 bytes) on source: (identifier:  0x101f64630)
              CommCenter
              #I Data usage threshold reached for internet context
              

               

              On the smart camera, the failure is logged with the following message :

               

              Trying to associate with 76:8d:08:74:3c:33 (SSID='iphone6' freq=2412 MHz)
              CTRL-EVENT-ASSOC-REJECT status_code=16
              CTRL-EVENT-SCAN-STARTED
              CTRL-EVENT-SCAN-RESULT
              

               

              Do you have an idea, what could be the cause of these messages ?

               

              I forgot to mention that the smart camera works well with an Android device sharing its own cellular connection with a personal hotspot.

               

              Thanks for any help.

              Regards

                • Re: Can't connect devices to iOS Personal Hotspot
                  eskimo Apple Staff Apple Staff (12,475 points)

                  Correct me if I'm wrong I might be misunderstand what you're telling, but if a client (in my case a smart camera) is connected to Internet through the iPhone, then it is then on the same network as the iPhone, and the latter can "discuss" with the client over an IP, does it ?

                  You are, alas, being overly optimistic here.  I’ll explain this below but first I recommend that you take a quick look at my Wi-Fi Fundamentals post, which explains the terminology I’m going to use.

                  In infrastructure Wi-Fi packets don’t go from STA to STA.  Rather, all traffic is routed via the AP.  The AP gets to decide whether to forward that traffic or not.  Most consumer APs do this forwarding and there’s no option to disable it.  However, it’s very common for hotspot APs (like those in a big chain of coffee shops) to disable STA-to-STA communication.  It’s also common to see this disabled (or restricted) in enterprise environments.

                  Note Wi-Fi isn’t the only technology that limits peer-to-peer traffic like this.  Most WWAN providers restrict peer-to-peer traffic on their networks.

                  My understanding is that Personal Hotspot does not restrict STA-to-STA traffic but, as I noted in the post I referenced earlier, that’s not a fundamental user-level goal of Personal Hotspot, so I’d be reluctant to base a product on that.

                  In your situation I’d split the problem up into two:

                  • In situations where the user wants the accessory to join the home network, use WAC to get it on that network.

                  • In other situations (out in the field, for example), put the accessory in AP mode and then have you app ask iOS to join the accessory’s network via NEHotspotConfigurationManager.

                  Note For more info on these technologies, see QA1942 iOS Wi-Fi Management APIs.

                  Coordinating all of this is easier if you have a reliable way to talk to your accessory without Wi-Fi.  A lot of accessory developers use Bluetooth LE for managing the setup process.


                  Of course none of the above explains why your accessory is unable to join the Personal Hotspot Network.  I can’t help you with that, alas.  DTS doesn’t provide support for Apple’s implementation of industry standard protocols, like Wi-Fi, so I have very little experience on that front.

                  Share and Enjoy

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

                    • Re: Can't connect devices to iOS Personal Hotspot
                      cdescours_eco Level 1 Level 1 (0 points)

                      Thanks for your detailed explanation about WiFi.

                      After further tests, it turned out that the smart camera could connect to the iOS device without any modifications, when the test was ran outdoor or in a different place than the office, where we develop the software ... it is curious, but it seems that is an  environment-related problem. Do you have any idea about that ?

                      Anyway, we're going to consider using a Bluetooth connexion to use the smart camera... but the current setup might work on some conditions.

                        • Re: Can't connect devices to iOS Personal Hotspot
                          eskimo Apple Staff Apple Staff (12,475 points)

                          Do you have any idea about that ?

                          Nothing particularly insightful, alas.  I rarely look behind the Wi-Fi curtain because it’s not needed for my job.  You might be able to make some progress by combining a Wi-Fi level packet trace with debugging info on the accessory.  For example, if the accessory is not ‘seeing’ the Personal Hotspot Wi-Fi, you can use the Wi-Fi level packet trace to see whether the beacon frames are being sent correctly (or not, but realistically I think that they are because this tech works in general), and then debug the accessory to see whether it’s receiving them and, if it is, where things are going wrong from there.

                          You can use your Mac to get a Wi-Fi level packet trace, albeit with some serious limitations.  QA1176 Getting a Packet Trace has the details.  If the Mac’s limitations are too severe, there are other, better, dedicated Wi-Fi packet trace solutions.  I don’t have a specific recommendation because, hey, I’m so not a Wi-Fi engineer (-:

                          Share and Enjoy

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