Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_picker crashes flutter application on iOS devices when an image in the gallery is tapped more than once #20214

Closed
Blakexx opened this issue Aug 4, 2018 · 15 comments
Labels
c: crash Stack traces logged to the console p: image_picker The Image Picker plugin. package flutter/packages repository. See also p: labels.

Comments

@Blakexx
Copy link

Blakexx commented Aug 4, 2018

Steps to Reproduce

Sample code: https://gist.github.com/Blakexx/fd1010e6649f01fabfdf9efeaf35d10f

  1. Click the button labeled "Select Image"
  2. Navigate to an image you wish to select
  3. Spam click/tap on the image

Logs

[+7825 ms] [DEVICE LOG] 2018-08-03 21:16:10.812228-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84623, Description: Loading Preferences From System CFPrefsD For Search List
[   +3 ms] [DEVICE LOG] 2018-08-03 21:16:10.816061-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84624, Description: continuous-discovery
[        ] [DEVICE LOG] 2018-08-03 21:16:10.817243-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84625, Description: discovery
[  +20 ms] [DEVICE LOG] 2018-08-03 21:16:10.836749-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84626, Description: discovering extensions
[   +6 ms] [DEVICE LOG] 2018-08-03 21:16:10.842411-0700  localhost Runner[31311]: (MobileCoreServices) [com.apple.launchservices:progress] Establishing xpc connection to lsd
[  +61 ms] [DEVICE LOG] 2018-08-03 21:16:10.905044-0700  localhost Runner[31311]: (MobileCoreServices) [com.apple.launchservices:progress] Received LSWorkspaceObserverPing, xpc connection established
[ +123 ms] [DEVICE LOG] 2018-08-03 21:16:11.029229-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84627, Description: begin using plugin
[+2209 ms] [DEVICE LOG] 2018-08-03 21:16:13.220946-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84628, Description: begin using plugin
[ +506 ms] [DEVICE LOG] 2018-08-03 21:16:13.737283-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84629, Description: Loading Preferences From System CFPrefsD For Search List
[+8183 ms] [DEVICE LOG] 2018-08-03 21:16:21.926096-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462a, Description: begin using plugin
[   +4 ms] [DEVICE LOG] 2018-08-03 21:16:21.932839-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462b, Description: begin using plugin
[ +250 ms] [DEVICE LOG] 2018-08-03 21:16:22.183120-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462c, Description: Loading Preferences From System CFPrefsD For Search List
[+2402 ms] [DEVICE LOG] 2018-08-03 21:16:24.582724-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462d, Description: TCCAccessRequest() IPC
[  +18 ms] [DEVICE LOG] 2018-08-03 21:16:24.593591-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462e, Description: TCCAccessRequest() IPC
[   +1 ms] [DEVICE LOG] 2018-08-03 21:16:24.605607-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x8462f, Description: Loading Preferences From System CFPrefsD
[  +63 ms] [DEVICE LOG] 2018-08-03 21:16:24.654157-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84b30, Description: TCCAccessRequest() IPC
[        ] [DEVICE LOG] 2018-08-03 21:16:24.654240-0700  localhost Runner[31311]: (Runner) Created Activity ID: 0x84b31, Description: TCCAccessRequest() IPC
[ +446 ms] Service protocol connection closed.
[   +1 ms] Lost connection to device.
Analyzing image_picker_proof...                                  
No issues found! (ran in 3.9s)
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.3 17D47, locale en-US)
    • Flutter version 0.5.1 at /Users/"MY_NAME"/Documents/flutter
    • Framework revision c7ea3ca377 (9 weeks ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/"MY_NAME"/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • 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-1024-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    ✗ Brew not installed; use this to install tools for iOS device development.
      Download brew at https://brew.sh/.

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 25.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] Connected devices
    ! No devices available

! Doctor found issues in 2 category.
@zoechi zoechi added c: crash Stack traces logged to the console plugin labels Aug 24, 2018
@zoechi zoechi added this to the Goals milestone Aug 24, 2018
@lordgreg
Copy link

lordgreg commented Dec 3, 2018

Is this issue being looked at? We're having quite few users that are clicking on the image and, crashing the app with it.

@amirh amirh added the p: image_picker The Image Picker plugin. label Jan 3, 2019
@cyanglaz
Copy link
Contributor

cyanglaz commented Jan 8, 2019

I just created a PR for a fix flutter/plugins#1051

@Blakexx
Copy link
Author

Blakexx commented Jan 8, 2019

Thanks for the update!

@Blakexx Blakexx changed the title image_picker crashes flutter application on IOS devices when an image in the gallery is tapped more than once image_picker crashes flutter application on iOS devices when an image in the gallery is tapped more than once Jan 9, 2019
@Blakexx Blakexx closed this as completed Jan 10, 2019
@amirh amirh modified the milestones: Goals, Near-term Goals Jan 10, 2019
@nicowernli
Copy link

This still happens to me, as soon I execute

final image = await ImagePicker.pickImage(
      source: ImageSource.camera,
);

I get the Lost connection to device. on iPhone

@cyanglaz
Copy link
Contributor

cyanglaz commented Jun 7, 2019

@nicowernli Could you post your flutter doctor -v here with the iphone conected? Also, what is the image_picker version that you used?

@nicowernli
Copy link

Hi @cyanglaz thanks for the response. Here is my data:

[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale es-ES)
    • Flutter version 1.5.4-hotfix.2 at /Users/nicowernli/development/flutter
    • Framework revision 7a4c33425d (6 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/nicowernli/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • 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-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.7.0

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 36.0.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] Connected device (2 available)
    • Android SDK built for x86 • emulator-5554                        • android-x86 • Android 7.1.1 (API 25) (emulator)
    • iPhone Xʀ                 • DC9EB448-2E8D-4627-A685-69B970C330F5 • ios         • com.apple.CoreSimulator.SimRuntime.iOS-12-2
      (simulator)

• No issues found!

I tried with:

dependencies:
  image_picker: ^0.6.0+9

I was using iPhone Xr simulator (iOS 12.2).

Regards

@cyanglaz
Copy link
Contributor

@nicowernli Thank you for providing the info. May I ask why did you test camera with Simulator? Although it shouldn't crash (which I will still investigate), camera should be tested on real device since the Simulator won't have the camera feature. (Although you can test ImageSource.gallery using simulator).

@nicowernli
Copy link

Thanks @cyanglaz, I'm going to try with the gallery then. I know Android better than iOS, and I thought the simulator would use the MB camera, thats why I was testing in the simulator.

@cgx9
Copy link

cgx9 commented Jun 20, 2019

@nicowernli do you forget to do these?

iOS
Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy - Microphone Usage Description in the visual editor.

@nicowernli
Copy link

@cgx9 you are totally right, that was my error. I didn’t try the camera again but it happened to me opening the gallery until I added those keys. Sorry for that!

@ailic88
Copy link

ailic88 commented Sep 24, 2019

@zoechi @dnfield @cyanglaz
It is happening again on 0.6.1+4, iOS 12.
All permission are granted. Interesting thing is that app only crashes when it is started
for the FIRST time or again after crash.

[✓] Flutter (Channel stable, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G95, locale en-RS)
• Flutter version 1.9.1+hotfix.2 at /Users/aleksandar/Library/Developer/flutter
• Framework revision 2d2a1ff (3 weeks ago), 2019-09-06 18:39:49 -0700
• Engine revision b863200
• Dart version 2.5.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Java binary at: /Applications/AndroidStudio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
• Android Studio at /Applications/AndroidStudio.app/Contents
• Flutter plugin version 38.2.3
• Dart plugin version 191.8423
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (1 available)
• iPhone 6 - iOS 12 • deb216dc53207e496f7bbc8ab0f8d92721c386a0 • ios • iOS 12.4.1

• No issues found!

Crashlog

2019-08-07 11:01:07.327180+0200 Influencer[1246:131708] CGImageSourceCreateWithData:3273: *** ERROR: CGImageSourceCreateWithData: data is nil2019-08-07 11:01:07.328006+0200 Influencer[1246:131708] CGImageSourceGetType:3548: *** ERROR: CGImageSourceGetType: source is nil2019-08-07 11:01:07.328638+0200 Influencer[1246:131708] CGImageDestinationCreateWithData:3086: *** ERROR: CGImageDestinationCreateWithData: type is nil2019-08-07 11:01:07.328921+0200 Influencer[1246:131708] CGImageDestinationAddImageFromSource:3283: *** ERROR: CGImageDestinationAddImageFromSource: destination is nil2019-08-07 11:01:07.329169+0200 Influencer[1246:131708] CGImageDestinationFinalize:3394: *** ERROR: CGImageDestinationFinalize: destination is nilwarning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.

@pytong
Copy link

pytong commented Apr 14, 2020

I use image_picker_modern and it seems to work so far.

@arteminthesky
Copy link

@cyanglaz I also reproduce it in 0.6.5+1

@arteminthesky
Copy link

@ailic88 hi! it fixed in version 0.6.5+2

@lock
Copy link

lock bot commented May 6, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators May 6, 2020
@flutter-triage-bot flutter-triage-bot bot added the package flutter/packages repository. See also p: labels. label Jul 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console p: image_picker The Image Picker plugin. package flutter/packages repository. See also p: labels.
Projects
None yet
Development

No branches or pull requests

10 participants