react-native-permissions icon indicating copy to clipboard operation
react-native-permissions copied to clipboard

request(Permissions.PERMISSIONS.IOS. BLUETOOTH_PERIPHERAL) returns unavailable after pressing `OK` on iOS version 13

Open BohdanIvanov opened this issue 6 years ago • 14 comments

Hello everyone!

I've faced an issue regarding request functionality in iOS. I'm trying to request the Bluetooth service permission and after pressing OK to allow my application to use the Bluetooth, the request returned Unavailable, when I'm expecting to receive Granted status. After that, any attempt to enable Bluetooth ends with the app crash. I will add a screenshot below. On pressing Don't allow it returns Blocked status as it should. It basically means that functionality is not available for usage, even with allowing to use it. Does anyone have a similar issue?

Thank you in advance.

Steps to reproduce:

  1. Launch app with react-native-permissions library
  2. Perform request(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL)
  3. Press OK. The request returns the unavailable response
  4. Enable Bluetooth

Received error message:

Screenshot 2020-02-01 at 09 44 19

NOTES:

  • Using a real device (iPhone XS)
  • iOS 13.3 version
  • Both NSBluetoothAlwaysUsageDescription and NSBluetoothPeripheralUsageDescription were added to Info.plist

BohdanIvanov avatar Jan 31 '20 16:01 BohdanIvanov

@BohdanIvanov Are you working in the simulator? Please fill the issue template for more informations.

zoontek avatar Jan 31 '20 16:01 zoontek

@zoontek I'm using actual devices. Did check on iPhone XS multiple times. await request(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL) returns an unavailable response after OK was pressed.

BohdanIvanov avatar Jan 31 '20 18:01 BohdanIvanov

@BohdanIvanov Did you added bluetooth-peripheral in your app supported capabilities?

zoontek avatar Feb 03 '20 18:02 zoontek

@zoontek Didn't notice any bluetooth-peripheral option in capabilities inside of Xcode. Can you please share a screenshot?

BohdanIvanov avatar Feb 04 '20 06:02 BohdanIvanov

Sure (Bluetooth peripheral = Acts as a Bluetooth LE accessory)

Screenshot 2020-02-04 at 10 22 36

Screenshot 2020-02-04 at 10 22 44

zoontek avatar Feb 04 '20 09:02 zoontek

@BohdanIvanov Any progress?

zoontek avatar Feb 29 '20 13:02 zoontek

@zoontek Sorry that couldn't answer earlier. For now, I've decided to go another way, without using the request method. I'll try to test in the nearest time and will let you know. Thank you :)

BohdanIvanov avatar Mar 02 '20 07:03 BohdanIvanov

I tried the mentioned steps but bluetooth permissions are not working. I am using iOS 14.2

ireshdudeja avatar Apr 09 '21 16:04 ireshdudeja

Also seeing this :( not working ios 14.

dorthwein avatar Dec 22 '21 16:12 dorthwein

The critical question @dorthwein is this I think:

@BohdanIvanov Did you added bluetooth-peripheral in your app supported capabilities?

...additionally it appears the example app tests every single one, does the example app demonstrate this one? Worth confirming, and if it does, does the example app work?

mikehardy avatar Dec 22 '21 16:12 mikehardy

Does it still work on iOS real device for Bluetooth on iOS 17.5 if I have followed all steps above?

@zoontek

esiltu avatar Aug 21 '24 09:08 esiltu

@esiltu Yes

zoontek avatar Aug 21 '24 12:08 zoontek

If you're encountering the issue where requesting Bluetooth permission returns unavailable, add this line to your iOS -> Podfile: pod 'Permission-BluetoothPeripheral', :path => "../node_modules/react-native-permissions/ios/BluetoothPeripheral" and rebuild your app to resolve the issue. I'm using version 17.5.

@zoontek thanks !

esiltu avatar Aug 22 '24 09:08 esiltu

@esiltu Or read the documentation (iOS setup especially)

zoontek avatar Aug 22 '24 10:08 zoontek