dylan dylan - 1 month ago 10
Swift Question

How can I obtain my Bluetooth MAC Address using Swift on macOS?

I've looked online in many places on trying to obtain the Bluetooth MAC Address of my Macbook Air. Everything I've stumbled upon has only been based towards iOS development and nothing towards the macOS field. Everything else says it has been depreciated past iOS 7, so I don't know if it would be possible on the latest Mac operating system. Does anyone know if it is possible under any framework? I'm not looking to submit this to the App Store.

Answer

The best option I could find for obtaining the Bluetooth MAC Address from a macOS app with Swift revolves around executing a terminal command and then formatting the output.

It would just be a matter of specifying the launchPath of networksetup & using the flag listallhardwareports to obtain an output.

Comments