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

Bluetooth permission on IOS<13 #151

Open
aviya-smila opened this issue Sep 8, 2020 · 1 comment
Open

Bluetooth permission on IOS<13 #151

aviya-smila opened this issue Sep 8, 2020 · 1 comment

Comments

@aviya-smila
Copy link

I have an issue with IOS pre 13, the callback for permission.request isn't being called.
is there a way to callback with authorized automatically?

@kaiserabliz
Copy link

kaiserabliz commented Sep 8, 2020

I don't think callback works for Bluetooth permission authorization change. I suggest you check the authorization status in viewDidLoad for your action or use UIApplication.didBecomeActiveNotification key with NotificationCenter.
Or this might answer your question:
Replace code in Bluetooth.swift
if #available(iOS 13.0, *) {
switch CBCentralManager().authorization {
case .restricted: return .disabled
case .denied: return .denied
case .notDetermined, .allowedAlways: break
@unknown default: return .notDetermined
}
} else {
switch CBPeripheralManager.authorizationStatus() {
case .restricted: return .disabled
case .denied: return .denied
case .notDetermined, .authorized: break
@unknown default: return .notDetermined
}
}

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

2 participants