flutter-permission-handler
flutter-permission-handler copied to clipboard
contact permission crashes on IOS
🐛 Bug Report
I am using permission_handler package to get the permission to access the contacts but as irequest the permission to access contacts my app crashes on IOS. Crash only happens when i run the app in release mode flutter run --release. Other permission like notifications and camera are working fine
Expected behavior
Access contact permission successfully granted or denied
Reproduction steps
- Add permission in Info.plist
- Add permission in Podfile
- Add package dependency in pubspec.yaml
- Add the following code to access contacts
final status = await Permission.contacts.status;
try {
if (status.isDenied || status.isPermanentlyDenied) {
await Permission.contacts.request();
}
} catch (e) {
print('e ${e.toString()}');
}
Configuration
Version: 9.2.0
Platform:
- [ ] :iphone: iOS
I have the same problem with the 8.1.6 version.
My workaround is to ask the permission with this package https://pub.dev/packages/flutter_contacts And to get the contacts with this package https://pub.dev/packages/contacts_service
My problem was that the contact request info was missing from Info.plist
file.
Adding
<key>NSContactsUsageDescription</key>
<string>Allow access to contacts</string>
Have solved it for me.
Dear @bilalgodesto,
Did you add the correct key to the plist?And do you perhaps have the stack trace?
Kind regards,
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.