fluttercommunity / flutter_contacts

Contacts Service - A Flutter plugin to retrieve and manage contacts on Android and iOS devices. Maintainer: @lukasgit
https://pub.dev/packages/contacts_service
MIT License
153 stars 69 forks source link

PlatformException on ios (simulator) with Flutter beta 3, dart 2 when adding a contact #16

Closed niektemme closed 6 years ago

niektemme commented 6 years ago

First I would like to thank you for your great work and writing this package. I think it is very helpful to a lot of developers.

I upgraded yesterday to flutter beta 3 and the latest version of the contacts_service plugin. I tried the example on both ios (simulator) and android (first pixel). On android everything works fine. On ios (iPhone X simulator), I get a PlatformException error when adding a new contact (see error below). I have included the flutter doctor output bellow the error. On android adding a contact works fine. On both ios and android displaying the contacts works fine. Of course in the simulator the app has contacts access. If you need any more input, please let me know.

[VERBOSE-2:dart_error.cc(16)] Unhandled exception: PlatformException(, Failed to add contact, null)

0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:547:7)

1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)

#2 ContactsService.addContact (package:contacts_service/contacts_service.dart:20:57) #3 _AddContactPageState.build. (file:///Users/niek/Sourcetree/flutter_contactsn/example/lib/main.dart:170:31) #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14) #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:549:30) #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) #7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9) #8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7) Nicolaass-MacBook-Pro:example niek$ flutter doctor -v [✓] Flutter (Channel beta, v0.3.2, on Mac OS X 10.13.4 17E202, locale en-NL) • Flutter version 0.3.2 at /Users/niek/Library/flutter • Framework revision 44b7e7d3f4 (4 weeks ago), 2018-04-20 01:02:44 -0700 • Engine revision 09d05a3891 • Dart version 2.0.0-dev.48.0.flutter-fe606f890b [✓] Android toolchain - develop for Android devices (Android SDK 27.0.3) • Android SDK at /Users/niek/Library/Android/sdk/ • Android NDK location not configured (optional; useful for native profiling support) • Platform android-27, build-tools 27.0.3 • ANDROID_HOME = /Users/niek/Library/Android/sdk/ • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08) • All Android licenses accepted. [✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.3.1, Build version 9E501 • ios-deploy 1.9.2 • CocoaPods version 1.4.0 [✓] Android Studio (version 3.0) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08) [✓] VS Code (version 1.23.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Dart Code extension version 2.12.1 [✓] Connected devices (2 available) • Pixel • FA69K0311726 • android-arm64 • Android 8.1.0 (API 27) • iPhone X • 266F13A9-C30F-48CE-9303-7F2C32BE2D6E • ios • iOS 11.3 (simulator) • No issues found!
zoechi commented 6 years ago

What code did you use to add the contact? What fields did you set?

niektemme commented 6 years ago

For the code I used the example in this git repository. (see git status below).

  1. Checked out latest version of this git repo
  2. cd to example
  3. flutter run -d iPhone

Fields that I set (sorry for not giving a complete example earlier). The fields here refer to the UI in the simulator of the running flutter contacts plugin example app. 1) First name, Value: Aatest3 2) Last name, Value Aatest4 3) Phone, Value 48326903

Nicolaass-MacBook-Pro:flutter_contactsn niek$ git status On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

modified:   example/ios/Flutter/flutter_assets/LICENSE
modified:   example/ios/Podfile.lock
modified:   example/ios/Runner.xcodeproj/project.pbxproj

Untracked files: (use "git add ..." to include in what will be committed)

example/ios/Flutter/flutter_assets/kernel_blob.bin
example/ios/Flutter/flutter_assets/platform.dill

no changes added to commit (use "git add" and/or "git commit -a")

niektemme commented 6 years ago

Just wanted to give an update on this issue. I tried reverting back to version 0.5 of the contacts pluging. This by checking out the git repo at tag 0.0.5. Then the example works fine in the ios simulator. Tested adding a contact in the simulator and this worked without problems and errors.

According to the git log version 0.0.5 is the version before the thumbnails update. This makes me think there could be a problem with the thumbnails and iOS at least with the iOS simulator.