IOS 13 - Enable checking wifi information on IOS 13


#1

Info

1. Project: Vitcon Wifi manager
2. Developer: Khánh Nguyên

The first one, we need to enable the Access WiFi Information capability in Xcode

imageimage

With iOS < 13, we can use CNCopyCurrentNetworkInfo() .

import SystemConfiguration.CaptiveNetwork

imageimage

CNCopyCurrentNetworkInfo() returns nil in iOS 13 and later


Watch WWDC19 Session 713:Advances in Networking, Part 2.
Now you all know the important privacy to Apple. And one of the things we realized. Is that… Accessing Wi-Fi information can be used to infer location.
So starting now, to access that Wi-Fi information. You’ll need the same kind of privileges that you’ll need to get other location information.
imageimage

Requires Capability: Access Wi-Fi Information

  • Must also meet at least one of criteria below
  • Apps with permission to access location
  • Currently enabled VPN app
    NEHotspotConfiguration (only Wi-Fi networks that the app configured)
    Otherwise, returns nil

Get Wi-Fi SSID in iOS 13 and later

Import Core Location framework

![image|144x30](upload://5MIWGjfuynl1395KKKfVCA4iRsR.jpeg)![image|144x30](upload://wbKrF2Kglo43GgY1TCOJ7ZDvBid.jpg)

Permision request in Info.plist
imageimage

Create Model and Variables
imageimage
imageimage
imageimage

Function to update UI (Get Wifi name)
imageimage

Ask location permission

imageimage

Implement CLLocationManagerDelegate
imageimage