flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

contact permission crashes on IOS

Open bilalgodesto opened this issue 2 years ago • 2 comments

🐛 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

bilalgodesto avatar May 14 '22 14:05 bilalgodesto

I have the same problem with the 8.1.6 version.

muknta avatar May 16 '22 09:05 muknta

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

ThebaultLouis avatar May 25 '22 07:05 ThebaultLouis

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.

eslamodeh avatar Feb 24 '23 12:02 eslamodeh

Dear @bilalgodesto,

Did you add the correct key to the plist?And do you perhaps have the stack trace?

Kind regards,

TimHoogstrate avatar Aug 23 '23 13:08 TimHoogstrate

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.

github-actions[bot] avatar Sep 06 '23 14:09 github-actions[bot]