Currently on my MacBookPro Early 2015 running macOS 12.4 the IOBluetooth API is behaving weird. First users noticed in #20 that the Type Method recentDevices() is returning an empty array. After switching to pairedDevices() in version 1.0.2 I'm getting the devices as a list again…
Unfortunately the method recentDevices() no always returns the current DateTime. The official Apple documentation and some googling around didn't help me at all to resolve the issues.
As a part time developer for the macOS platform this whole situation is quite frustrating to me… Although I created a small Swift script that demonstrates the behavior:
import IOBluetooth
var pairedDevices = IOBluetoothDevice.pairedDevices() as! [IOBluetoothDevice]
var recentDevices = IOBluetoothDevice.recentDevices(0) as! [IOBluetoothDevice]
print("Paired Devices: ", pairedDevices.count)
for device in pairedDevices {
print(device.nameOrAddress!, device.recentAccessDate()!)
}
// prints all paired devices, but recentAccessDate is always now!
print("Recent Devices: ", recentDevices.count)
for device in recentDevices {
print(device.nameOrAddress!, device.recentAccessDate()!)
}
// prints nothing – recentDevices is empty
Currently on my MacBookPro Early 2015 running macOS 12.4 the IOBluetooth API is behaving weird. First users noticed in #20 that the Type Method
recentDevices()
is returning an empty array. After switching topairedDevices()
in version 1.0.2 I'm getting the devices as a list again… Unfortunately the methodrecentDevices()
no always returns the current DateTime. The official Apple documentation and some googling around didn't help me at all to resolve the issues. As a part time developer for the macOS platform this whole situation is quite frustrating to me… Although I created a small Swift script that demonstrates the behavior: