Open usamamanzoor07 opened 1 year ago
I have the same issue with Ios Simulator and Phone, Although Contact Permission is granted already. In my case
this code returns zero contacts although I have contacts in my native contact app.
FlutterContacts.getContacts( // (phones, emails, addresses, websites, etc) // <<<<< NOTE: [withProperties] is required for accounts withProperties: true, sorted: false, withAccounts: true, );
Here is my Flutter Doctor summary
`[✓] Flutter (Channel stable, 3.3.7, on macOS 13.1 22C5033e darwin-arm, locale en-PK) • Flutter version 3.3.7 on channel stable at /Users/admin/Downloads/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision e99c9c7cd9 (6 weeks ago), 2022-11-01 16:59:00 -0700 • Engine revision 857bd6b74c • Dart version 2.18.4 • DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1) • Android SDK at /Users/admin/Library/Android/sdk • Platform android-33, build-tools 33.0.0-rc1 • ANDROID_HOME = /Users/admin/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/admin/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1) • 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 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.74.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.54.0
[✓] VS Code (version 1.74.0-insider) • VS Code at /Users/admin/Downloads/Visual Studio Code - Insiders.app/Contents • Flutter extension version 3.55.20221129
[✓] Connected device (3 available) • IPhone 12 (16.1) (mobile) • 6E35EF09-1791-4919-8599-ACFBEBAA21CC • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C5033e darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.124
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!`
I was able to import all native contact after commenting parameters in getContact().
Here is the Code `
try {
final List<Contact> contactsFromIos = await FlutterContacts.getContacts(
withAccounts: true,
);
log('Contact from Native for Ios is ${contactsFromIos.length}');
} on Exception catch (e, stack) {
log(stack , stackTrace: stack,);
}`
// Note this issue is only caused by Ios device and simulators
@joachimvalente @scroollocker @anggrayudi @jadasi I am using flutter_contacts package it is smoothly running on all devices except Mi A1 Android Version 9 and contacts permission is enabled in it. I checked it in app permissions. No Error but returning null on all functions including getContacts and openExternalPick.
I can confirm the same issue. Is there a solution? BTW: This has nothing to do with iOS.
Thanks for reporting! I will look into it shortly.
@joachim-quis For Android version 9 the problem still persists. I can not fetch contacts even permission granted.
@joachimvalente @scroollocker @anggrayudi @jadasi I am using flutter_contacts package it is smoothly running on all devices except Mi A1 Android Version 9 and contacts permission is enabled in it. I checked it in app permissions. No Error but returning null on all functions including getContacts and openExternalPick.