I'm working with Delphi 11.3 for Android and IOS and I need to know the Wi-Fi properties such as SSID and IP, on Android it's very easy but on IOS I'm having difficulties, all the alternatives I find are already obsolete and no longer work, really. I don't know where else to look, can anyone give me some direction?
I have already tested some libraries like Kastri but I was not successful
The native function for getting the current WiFi SSID is fetchCurrent()
on NEHotspot
Note that the documentation for this method states that your app must meet all four of the following criteria
- The app is using the Core Location API and has user’s authorization to access precise location.
- The app used the NEHotspotConfiguration API to configure the current Wi-Fi network.
- The app has active VPN configurations installed.
- The app has an active NEDNSSettingsManager configuration installed.
This is incorrect. You don't need to meet all four criteria. You must meet one of the four criteria. In your case you would need to ask for and receive location permission.
Additionally, you need to add the "Access Wi-Fi Information" capability to your project in Xcode.
I know that you asked about Delphi specifically, and I'm afraid I can't help you there, but hopefully the details of how it is done natively will help you.
Getting the IP address is much more difficult. The general advice from this developer thread is Don't try and get the device IP address. It is not as straight-forward as it may seem at first glance; Devices have multiple active network interfaces.
Since you have a Bluetooth connection to your device, it is probably simpler to ask the device for its IP address once it has joined the Wifi Network successfully. Alternatively use Bonjour to discover the device.
There is also a useful thread in the Apple Developer Forums that suggest some other approaches to accessory configuration.