diff --git a/Cargo.toml b/Cargo.toml index 9e09dd31..00e69bb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ jni-utils = "0.1.1" cocoa = "0.25.0" objc = "0.2.7" libc = "0.2.147" +os_info = "3.7.0" [target.'cfg(target_os = "windows")'.dependencies] windows = { version = "0.51.1", features = ["Devices_Bluetooth", "Devices_Bluetooth_GenericAttributeProfile", "Devices_Bluetooth_Advertisement", "Devices_Radios", "Foundation_Collections", "Foundation", "Storage_Streams"] } diff --git a/src/corebluetooth/framework.rs b/src/corebluetooth/framework.rs index b00830b2..86b8addf 100644 --- a/src/corebluetooth/framework.rs +++ b/src/corebluetooth/framework.rs @@ -174,7 +174,13 @@ pub mod cb { // CBManager pub fn manager_authorization() -> CBManagerAuthorization { - unsafe { msg_send![class!(CBManager), authorization] } + use os_info::Version::Semantic as OSSemVer; + + if os_info::get().version() >= &OSSemVer(10, 15, 0) { + unsafe { msg_send![class!(CBManager), authorization] } + } else { + CBManagerAuthorization::NotDetermined + } } #[derive(Copy, Clone, Debug, Eq, PartialEq)]