Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 - How to check if user has accepted Bluetooth permission?

As part of iOS 13’s, apps now need to request permission if they want to access Bluetooth. enter image description here

How to check if user has accepted Bluetooth permission?

like image 590
phnmnn Avatar asked Dec 09 '25 13:12

phnmnn


1 Answers

Try this:

var isBluetoothPermissionGranted: Bool {
    if #available(iOS 13.1, *) {
        return CBCentralManager.authorization == .allowedAlways
    } else if #available(iOS 13.0, *) {
        return CBCentralManager().authorization == .allowedAlways
    }
    
    // Before iOS 13, Bluetooth permissions are not required
    return true
}
like image 186
al_mota Avatar answered Dec 12 '25 02:12

al_mota



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!