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.


    WIFI SSID

    Pythonista
    8
    19
    11485
    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.
    • inyourfaceplate
      inyourfaceplate last edited by

      Hi there!

      Can anyone show me how to access the current WIFI SSID via Pythonista? This would be awesome in the widget.

      Thanks,
      John

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

        https://forum.omz-software.com/topic/3283/can-pythonista-change-settings-such-as-choosing-wifi-network

        https://forums.developer.apple.com/thread/11807

        NEHotspotHelper supportedNetworkInterfaces

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

          It must be possible because the Launcher app allows to display it in its widget.

          example

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

            I think this requires a special app entitlement

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

              I think you're right, as I´ve read

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

                "Your program needs the com.apple.wifi.manager-access entitlement to use any of the WiFiManager functions."

                http://iphonedevwiki.net/index.php/MobileWiFi.framework

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

                  This works for me:

                  from objc_util import *
                  
                  def get_ssid():
                      CNCopyCurrentNetworkInfo = c.CNCopyCurrentNetworkInfo
                      CNCopyCurrentNetworkInfo.restype = c_void_p
                      CNCopyCurrentNetworkInfo.argtypes = [c_void_p]
                      info = ObjCInstance(CNCopyCurrentNetworkInfo(ns('en0')))
                      return str(info['SSID'])
                  
                  print('Current SSID:', get_ssid())
                  
                  scj643 vladimir_key 2 Replies Last reply Reply Quote 1
                  • cvp
                    cvp last edited by cvp

                    I was almost sure it was possible since Apple did stop to depreciate this CNCopyCurrentNetworkInfo in ios10...

                    Thanks for @inyourfaceplate

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

                      @omz Ah a c function I'm going to have to remember that for my objc_tools network submodule

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

                        omz's solution works great!

                        Thanks everyone!

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

                          Hi @omz,
                          I found that your solution is not work anymore (ios 13.3.1). Its return "wifi" instead of correct name. Do you have ideas?

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

                            @vladimir_key omz solution works for me but you need iOS 13.3 and that you Pythonista app has permission to access your location (iOS 13 limitation)

                            See Discussion

                            Seems that if you receive "wi-fi", you should be in iOS 12

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

                              Hi @cvp,
                              Thank you! Yep, it was location permission problem. Now its working and my iOS 13.3.1.

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

                                For some unknown (for me) reason, I got this error message:
                                "No method found for selector "isKindOfClass:"

                                Any clue?

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

                                  Same for me

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

                                    Looks to be some kind of internal bug in objc_util, though I don’t have an explanation right now.

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

                                      @omz seems that CNCopyCurrentNetworkInfo(ns('en0')) returns nil like old bug before ios13.3

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

                                        For me it no longer works since Pythonista 3.3

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

                                          Could have something to do with the fact that 3.3 is built with the iOS 13 SDK.

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post
                                          Powered by NodeBB Forums | Contributors