omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Objc_util is confusing me.

    Pythonista
    5
    9
    5725
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chibill
      chibill last edited by omz

      So I am trying to convert the following to python (can’t code block it on mobile...)

      @import SystemConfiguration.CaptiveNetwork;
      
      /** Returns first non-empty SSID network info dictionary.
       *  @see CNCopyCurrentNetworkInfo */
      - (NSDictionary *)fetchSSIDInfo
      {
          NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces());
          NSLog(@"%s: Supported interfaces: %@", __func__, interfaceNames);
      
          NSDictionary *SSIDInfo;
          for (NSString *interfaceName in interfaceNames) {
              SSIDInfo = CFBridgingRelease(
                  CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName));
              NSLog(@"%s: %@ => %@", __func__, interfaceName, SSIDInfo);
      
              BOOL isNotEmpty = (SSIDInfo.count > 0);
              if (isNotEmpty) {
                  break;
              }
          }
          return SSIDInfo;
      }
      

      But even when I load the SystemConfiguration framework I can't make an instance of CaptiveNetwork. Or am I totally doing this wrong.

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by JonB

        This works for me.
        (or, as gist).

        Not sure what you were trying, but you never need a captivenetwork info... maybe it is different on an actual captive hotspot

        1 Reply Last reply Reply Quote 0
        • chibill
          chibill last edited by

          Hm... strangely that only shows the wifi I am connected to. The snippet (from SO) is supposedly supposed to show all networks.

          1 Reply Last reply Reply Quote 0
          • omz
            omz last edited by

            @chibill This comment under the StackOverflow answer (that I assume you have this from) suggests that the original code does the same.

            1 Reply Last reply Reply Quote 0
            • omz
              omz last edited by

              I don’t think getting a list of all networks is actually possible without jailbreak.

              It would be possible with the (private) MobileWiFi framework, but in order to use it, an app needs special entitlements that 3rd-party apps can’t get.

              1 Reply Last reply Reply Quote 0
              • chibill
                chibill last edited by

                That’s annoying... (Why do people not say the full truth in SO answers like seriously)

                1 Reply Last reply Reply Quote 0
                • cvp
                  cvp last edited by

                  The only way I know is the Apple IOS app Airport

                  1 Reply Last reply Reply Quote 0
                  • chibill
                    chibill last edited by

                    Why does Apple make it so hard to do the simplest of things. (Like on Windows and Android they have API’s for this.)

                    Like how is know what WIFI is around you going to hurt them or the End user.

                    1 Reply Last reply Reply Quote 0
                    • fooois
                      fooois last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Powered by NodeBB Forums | Contributors