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.


    Is there something like a unique device id?

    Pythonista
    3
    7
    3949
    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.
    • M42e
      M42e last edited by

      Is there something like a unique device id?

      Thanks.

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

        No. Apple has removed the APIs for obtaining a unique device ID for privacy reasons (was often used for tracking purposes). Depending on your use case, there might be alternatives though (e.g. if the device's name would be enough for you to identify it among your other devices...).

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

          Hmm, yes i think that would be enough. Can you point me to the app which can be used to obtain the name?

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

            You could use the platform module for this. Quick example:

            import platform
            print platform.node()
            
            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by

              Why not use uuid?

              import uuid
              print(uuid.getnode())
              print(uuid.uuid1())
              
              1 Reply Last reply Reply Quote 0
              • omz
                omz last edited by

                @ccc That'll essentially return a random number on iOS. The result may be the same when running this multiple times within the same session, but when you restart Pythonista, you'll get a different one.

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

                  @ccc From the uuid.getnode() docs:

                  Get the hardware address as a 48-bit positive integer. The first time this runs, it may launch a separate program, which could be quite slow. If all attempts to obtain the hardware address fail, we choose a random 48-bit number with its eighth bit set to 1 as recommended in RFC 4122. “Hardware address” means the MAC address of a network interface, and on a machine with multiple network interfaces the MAC address of any one of them may be returned.

                  (on Unix systems, it usually launches ifconfig to determine the MAC address, which isn't possible on iOS, so it falls back to the random 48-bit number)

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