iOS Bluetooth custom message

Hi,

I’m struggling with the user prompt for the Bluetooth with a custom message. The default popup is : “Turn On Bluetooth to Allow “My application” to Connect to Accessories”.

Normally we can add a custom message with the corresponding string of NSBluetoothPeripheralUsageDescription key added in the Info.plist of the project.

But it seems that does not work for iOS 7, iOS 8 and iOS 9.

So I don’t know what I’m missing here.

Thanks for your help
Cyrille

This key is for something different:

If you want to customize the “you have BT turned off” message, instantiate a CBCentralManager and check its state property, and implement centralManagerDidUpdateState delegate method.

Thanks for your answer. But it seems that the answer in this Stackoverflow topic does not work as well.

I just want the iOS system message as described :
[App Name] would like to make data available to nearby bluetooth devices even when you’re not using the app.

I enabled the bluetooth-peripheral option in Background mode options but nothing happens except this iOS system popup for turning the bluetooth on so I’m really wondering how to get this message.

Best
Cyrille

I’m a bit confused.

Turn On Bluetooth to Allow [App Name] to Connect to Accessories

is shown when you instantiate CBCentralManager (because you want to scan for non-iBeacon BLE devices) with CBCentralManagerOptionShowPowerAlertKey option enabled. There’s no way to customize this message—instead, leave that option disabled (it is by default), and use UIAlertController to show your own pop-up.

[App Name] would like to make data available to nearby bluetooth devices even when you’re not using the app.

is when you instantiate the CBPeripheralManager (because you want to advertise as a BLE device) and have the bluetooth-peripheral Background Mode enabled, indicating that you want the advertising to work even if the app is not running.


Are you scanning for BLE devices or advertising as a BLE device?