Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
friedrichweise opened this issue May 28, 2022 · 0 comments
Open

Comments

@friedrichweise
Copy link
Owner

friedrichweise commented May 28, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant