CBPeripheralManager.authorizationStatus()
and CBPeripheralManagerAuthorizationStatus
根据苹果文档已弃用。现在检查用户是否已授予在后台使用蓝牙的权限的正确方法是什么?
CBPeripheralManagerDelegate
has peripheralManagerDidUpdateState
但那一去不复返unauthorized
无论用户是否授予权限,都只返回poweredOn
or poweredOff
CBCentralManager
and CBPeripheralManager
继承自CBManager https://developer.apple.com/documentation/corebluetooth/cbmanager.
从 iOS 13 开始,CBManager
has an authorization https://developer.apple.com/documentation/corebluetooth/cbmanager/3180033-authorization?changes=latest_minor财产。你可以检查这个.allowedAlways
.
您可以使用if #available(iOS 13.0, *)
有条件地使用authorization
在 iOS 13 及更高版本上
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)