Since the iOS 26.x.x release the currentWifiSSID method in the code below is failing with error "Object was not initialized (NSObject)..." when "no.RunMethod("currentWifiSSID", Null).AsString" is called, is anyone else experiencing this and/or have a possible solution? Location services are on for the app, I can confirm that this is still working on a device running an older iOS release.
B4X:
#Entitlement: <key>com.apple.developer.networking.wifi-info</key><true/>
.
.
.
Private Sub StartLocationUpdates
Dim no As NativeObject = Me
gstSSID = ""
Try
'if the user allowed us to use the location service or if we never asked the user before then we call LocationManager.Start.
If LocManager.IsAuthorized Or LocManager.AuthorizationStatus = LocManager.AUTHORIZATION_NOT_DETERMINED Then
LocManager.Start(0)
gstSSID = no.RunMethod("currentWifiSSID", Null).AsString
Log("Current SSID: " & gstSSID)
End If
Catch
End Try
End Sub
#If OBJC
#import <SystemConfiguration/CaptiveNetwork.h>
- (NSString *)currentWifiSSID {
NSString *ssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
// ssid = @"none";
if (info[@"SSID"]) {
ssid = info[@"SSID"];
}
}
return ssid;
}
#end if
Last edited: