Baseflow / Baseflow/flutter-permission-handler

[Bug]: Bluetooth permission on iOS permanently denied

Open
#1,333 17 comments 5 reactions 1 assignee Claimed by @TimHoogstrate View on GitHub
Dominant language
Dart
Stars
2.2k
Forks
970
Avg merge
14h 22m
Merged PRs (30d)
2

Description

### Please check the following before submitting a new issue.

- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [X] I have carefully [read the documentation](https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [ ] Android
- [X] iOS
- [ ] Windows

### Steps to reproduce

1. add the dependency to pubspec.yaml
2. add permission for BT in info.plist
3. update podfile with the following code:

```
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',

## dart: PermissionGroup.bluetooth
'PERMISSION_BLUETOOTH=1',

]
```

4. request permission in the code as following:

```
@override
Future getBluetoothPermission() async {
final PermissionStatus status = await Permission.bluetoothConnect.request();
return status == PermissionStatus.granted;
}
```

### Expected results

When the bt is enabled in Settings-> -> Bluetooth, result of the code should be "granted", when it is disabled it should be some variant of denied.

### Actual results

The actual result is that the code always return **permanentlyDenied**.

### Code sample

Code sample

```dart
@override
Future getBluetoothPermission() async {
final PermissionStatus status = await Permission.bluetoothConnect.request();
return status == PermissionStatus.granted;
}
```

### Screenshots or video

Screenshots or video demonstration

![image](https://github.com/Baseflow/flutter-permission-handler/assets/11629801/fbc3c3d9-c3cf-4284-bb78-13a8557fa366)
![Screenshot 2024-06-10 at 10 21 53](https://github.com/Baseflow/flutter-permission-handler/assets/11629801/bfc83611-81c8-4c19-aea8-59e156bcfa90)

### Version

11.3.1

### Flutter Doctor output

Doctor output

```console
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale en-GB)
• Flutter version 3.22.1 on channel stable at /Users/lj/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a14f74ff3a (3 weeks ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/lj/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.88.0

[✓] Connected device (5 available)
• SM S911B (mobile) • RFCW202MYCV • android-arm64 • Android 14 (API 34)
• iPhone-J1HPW2QJMW (mobile) • 00008110-001E14E90E3A401E • ios • iOS 17.5.1 21F90
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
• All expected network resources are available.

• No issues found!

```

Tested on iOS 17.5.1, iphone 14.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.