Skip to content

recentAccessDate() and recentDevices() not working as expected #22

@friedrichweise

Description

@friedrichweise

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions