Important
To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. When you enable this capability, Xcode automatically adds the Access WiFi Information entitlement to your entitlements file and App ID.
重要描述
在iOS 12+中使用此方法需要在Xcode中为应用授权获取WiFi信息的能力。授权后,Xcode会自动在App ID和应用的权限列表中增加获取WiFi信息的权限。
看到这里,解决方案就有了:Xcode -> [Project Name] -> Targets -> [Target Name] -> Capabilities -> Access WiFi Information -> ON