Fetch network security type

Hi,

Is there any API exposed to fetch network security type like "WPA", "WPA2", "WES" or None for iOS device?

Answered by DTS Engineer in 758661022

Yes. You can get the current network using the NEHotspotNetwork.fetchCurrent(completionHandler:) method and then read the securityType property.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Yes. You can get the current network using the NEHotspotNetwork.fetchCurrent(completionHandler:) method and then read the securityType property.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Eskimo,

Thanks for your reply and I tried NEHotspotNetwork.fetchCurrent(completionHandler:) method API and then read securityType property and the good thing is that it does work. Many thanks for suggesting this.

I have 2 more qs based on this.

  1. Do I need any permissions to use this API?
  2. NEHotspotNetwork.fetchCurrent(completionHandler:) method API is available in ios 14.0+ and securityType property is available in ios 15.0+, so

is there a way to get security type in lower versions of ios (< 15.0)??

Do I need any permissions to use this API?

Any app can call this API.

See the doc comments in <NetworkExtension/NEHotspotNetwork.h> for info about the permission model.

NEHotspotNetwork.fetchCurrent(completionHandler:) method API is available in iOS 14.0+ and securityType property is available in iOS 15.0+

Yep. It was a much-requested enhancement.

is there a way to get security type in lower versions of iOS (< 15.0)?

No.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you so much!

Fetch network security type
 
 
Q