How to get wifi signal strength in my macOS app

Hello,


Is there a way to get the wifi signal strength as, say, a value between 0 and 1, or similar in a macOS application? And would it also be possible to recieve a function call when the singal strength changes so I can run some code when that happens?


Thanks in advance. Any help is appreciated.

Answered by DTS Engineer in 325727022

Claude31 wrote:

You may also look at [

CWInterface
]

Yep. On macOS that’s the recommended approach.

Adalex3 wrote:

And would it also be possible to recieve a function call when the singal strength changes so I can run some code when that happens?

You should be able to get notifications via

CWWiFiClient
, and specifically the
-linkQualityDidChangeForWiFiInterfaceWithName:rssi:transmitRate:
delegate callback.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Why Swift 5 ?


This is for IOS, did you try to adapt to OSX ?

https://stackoverflow.com/questions/47564350/a-way-to-calculate-or-get-wifi-strength-on-swift-on-ios-11


You may also look at https://developer.apple.com/documentation/corewlan/cwinterface

func rssiValue() -> Int

The current aggregate received signal strength indication (RSSI) measurement (dBm) for the interface.

This is for iOS … ?

The approach you linked to is not supported because it involves grovelling around in the internal structures of the system’s views. That’s why, as noted in that post, it’s broken on iPhone X.

I’d appreciate you evaluating such links before posting them. At a minimum you should warn folks about the risks.

And, to be clear, there is no supported way for general apps to get Wi-Fi signal strength on iOS. QA1942 iOS Wi-Fi Management APIs has links to what limited Wi-Fi APIs that are available on that platform.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

Claude31 wrote:

You may also look at [

CWInterface
]

Yep. On macOS that’s the recommended approach.

Adalex3 wrote:

And would it also be possible to recieve a function call when the singal strength changes so I can run some code when that happens?

You should be able to get notifications via

CWWiFiClient
, and specifically the
-linkQualityDidChangeForWiFiInterfaceWithName:rssi:transmitRate:
delegate callback.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
How to get wifi signal strength in my macOS app
 
 
Q