From 043a4c8c7146f76b5fd3b508e9947cb6b81ae656 Mon Sep 17 00:00:00 2001 From: hengyu Date: Mon, 7 Jun 2021 01:38:46 +0800 Subject: [PATCH] Adapt to new method for getting authorization of bluetooth --- .../SPPermissionsBluetooth/SPBluetoothPermission.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/SPPermissionsBluetooth/SPBluetoothPermission.swift b/Sources/SPPermissionsBluetooth/SPBluetoothPermission.swift index fbc06563..6dbc3cd5 100644 --- a/Sources/SPPermissionsBluetooth/SPBluetoothPermission.swift +++ b/Sources/SPPermissionsBluetooth/SPBluetoothPermission.swift @@ -41,7 +41,15 @@ public class SPBluetoothPermission: SPPermissions.Permission { open var usageDescriptionKey: String? { "NSBluetoothAlwaysUsageDescription" } public override var status: SPPermissions.PermissionStatus { - if #available(iOS 13.0, tvOS 13, *) { + if #available(iOS 13.1, tvOS 13.1, *) { + switch CBCentralManager.authorization { + case .allowedAlways: return .authorized + case .notDetermined: return .notDetermined + case .restricted: return .denied + case .denied: return .denied + @unknown default: return .denied + } + } else if #available(iOS 13.0, tvOS 13.0, *) { switch CBCentralManager().authorization { case .allowedAlways: return .authorized case .notDetermined: return .notDetermined