Is there a way to programmatically determine the BLE version (4.0, 4.2, 5, etc.) of the iOS device (either iPhone or iPad) someone is using? I'm needing to find this to know whether certain features should be enabled on the app, features that require a certain data transfer rate. I'm using Swift, and the app will only communicate with one type of BLE module that is installed in our hardware.
Asked
Active
Viewed 831 times
1 Answers
0
One option is to hold a reference to various iPhone models Bluetooth capabilities, and then looking up the Bluetooth version by the model.
As per Has's answer, you can get the model of the device like this:
func getBluetoothVersion() -> Double{
let versions: [String: Double] = [
"iPhone8,1": 4.2,
"iPhone9,1": 4.2,
"iPhone10,3": 5.0 //Add as many as you want
]
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let identifier = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return versions[identifier + String(UnicodeScalar(UInt8(value)))]
}
}
The above code has not been tested, but it should work or require very minimal fixing.

Will
- 4,942
- 2
- 22
- 47