问题
In previous iOS versions you could detect if the user had bluetooth enabled or not without actually prompting the user's permission to access bluetooth. In iOS13, CBCentralManager now prompts bluetooth permission just to check if they have bluetooth turned on or not, regardless of if the app is actually going to use bluetooth directly.
Our app uses Apple's multipeer connectivity framework to communicate between devices (peer to peer) which uses a combination of wifi and bluetooth, or just wifi if bluetooth is disabled, but that is slower, so we like to remind our users to turn on bluetooth for a faster connection. Using this framework does not actually require a permission prompt for the app to use bluetooth because Apple manages all of that in a closed box so our app itself doesn't use bluetooth or require a permission prompt to work, but Apple's multipeer framework works better if the user has bluetooth enabled.
We want to simply remind the user to enable bluetooth for a faster connection, but only if they don't already have it on. However just checking if it is enabled the old way now requires a bluetooth permission prompt even though we won't be using bluetooth in the app.
In iOS13 is there a new method for just checking if bluetooth is enabled or not that doesn't require a bluetooth permission prompt.
来源:https://stackoverflow.com/questions/58683362/ios13-detect-if-bluetooth-is-enabled-without-prompting-bluetooth-usage-request