Post

Replies

Boosts

Views

Activity

IOS Signal strength issue
Our App demands a functionality to fetch the signal strength quality of the ISPs (both Mobile data and Wifi). We are using SwiftUI for development purpose.   Below mentioned mechanism (code snippet) was working fine with the previous iOS versions (Up to iOS 15)  func getSignalStrength() -> Int{ var signal : Int = 0 do { if let statusBarManager = UIApplication.shared.windows.filter({$0.isKeyWindow}).first?.windowScene?.statusBarManager, let localStatusBar = statusBarManager.value(forKey: "createLocalStatusBar") as? NSObject, let statusBar = localStatusBar.value(forKey: "statusBar") as? NSObject, let _statusBar = statusBar.value(forKey: "_statusBar") as? UIView, let currentData = _statusBar.value(forKey: "currentData") as? NSObject, let cellEntry = currentData.value(forKey: "cellularEntry") as? NSObject, let wifiEntry = currentData.value(forKey: "wifiEntry") as? NSObject, let wifiEnabled = try? ((wifiEntry.value(forKey: "isEnabled") as? Bool) == true), var strength = (wifiEnabled == true ? wifiEntry : cellEntry).value(forKey: "displayValue") as? Int { self.networkType = wifiEnabled == true ? "WIFI" : "CELL" debugPrint("SIGNAL STRENGTH : \(signal)")   if (wifiEnabled == true){ strength = strength == 3 ? 4 : strength }else { strength = strength - 1 } signal = strength } } catch let error { debugPrint("SIGNAL STRENGTH : \(signal)") } debugPrint("SIGNAL STRENGTH : \(signal)") return signal }   But` unfortunately, this is not working with the latest iOS 16 or 16.0.2 versions.   Please advise on this.
2
0
519
Sep ’22