flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.67k stars 27.6k forks source link

image_picker PlatformException invalid_source Error on iOS 14, 15 #136177

Closed elvisgn closed 1 year ago

elvisgn commented 1 year ago

Is there an existing issue for this?

What package does this bug report belong to?

image_picker

What target platforms are you seeing this bug on?

iOS

Have you already upgraded your packages?

Yes

Dependency versions

Pubspec Lock ```console packages: _fe_analyzer_shared: dependency: transitive description: name: _fe_analyzer_shared sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted version: "64.0.0" analyzer: dependency: transitive description: name: analyzer sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted version: "6.2.0" args: dependency: transitive description: name: args sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted version: "2.4.2" async: dependency: transitive description: name: async sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" url: "https://pub.dev" source: hosted version: "2.1.1" build: dependency: transitive description: name: build sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" url: "https://pub.dev" source: hosted version: "2.4.1" build_config: dependency: transitive description: name: build_config sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 url: "https://pub.dev" source: hosted version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted version: "4.0.0" build_resolvers: dependency: transitive description: name: build_resolvers sha256: "64e12b0521812d1684b1917bc80945625391cb9bdd4312536b1d69dcb6133ed8" url: "https://pub.dev" source: hosted version: "2.4.1" build_runner: dependency: "direct dev" description: name: build_runner sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b" url: "https://pub.dev" source: hosted version: "2.4.6" build_runner_core: dependency: transitive description: name: build_runner_core sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 url: "https://pub.dev" source: hosted version: "7.2.11" built_collection: dependency: transitive description: name: built_collection sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" url: "https://pub.dev" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value sha256: a8de5955205b4d1dbbbc267daddf2178bd737e4bab8987c04a500478c9651e74 url: "https://pub.dev" source: hosted version: "8.6.3" characters: dependency: transitive description: name: characters sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted version: "1.3.0" checked_yaml: dependency: transitive description: name: checked_yaml sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted version: "2.0.3" clock: dependency: transitive description: name: clock sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf url: "https://pub.dev" source: hosted version: "1.1.1" code_builder: dependency: transitive description: name: code_builder sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" url: "https://pub.dev" source: hosted version: "4.7.0" collection: dependency: transitive description: name: collection sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted version: "1.17.2" convert: dependency: transitive description: name: convert sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted version: "3.1.1" cross_file: dependency: transitive description: name: cross_file sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb url: "https://pub.dev" source: hosted version: "0.3.3+5" crypto: dependency: transitive description: name: crypto sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted version: "3.0.3" csslib: dependency: transitive description: name: csslib sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" url: "https://pub.dev" source: hosted version: "1.0.0" dart_style: dependency: transitive description: name: dart_style sha256: abd7625e16f51f554ea244d090292945ec4d4be7bfbaf2ec8cccea568919d334 url: "https://pub.dev" source: hosted version: "2.3.3" espresso: dependency: "direct dev" description: name: espresso sha256: a11b88c61209d873735bdf3f263ab63ce28459f8d6b6ee78257b2307a7c2edf2 url: "https://pub.dev" source: hosted version: "0.2.1" fake_async: dependency: transitive description: name: fake_async sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted version: "1.3.1" file: dependency: transitive description: name: file sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted version: "6.1.4" file_selector_linux: dependency: transitive description: name: file_selector_linux sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" url: "https://pub.dev" source: hosted version: "0.9.2+1" file_selector_macos: dependency: transitive description: name: file_selector_macos sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 url: "https://pub.dev" source: hosted version: "0.9.3+3" file_selector_platform_interface: dependency: transitive description: name: file_selector_platform_interface sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" url: "https://pub.dev" source: hosted version: "2.6.1" file_selector_windows: dependency: transitive description: name: file_selector_windows sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 url: "https://pub.dev" source: hosted version: "0.9.3+1" fixnum: dependency: transitive description: name: fixnum sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted version: "1.1.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" flutter_driver: dependency: transitive description: flutter source: sdk version: "0.0.0" flutter_plugin_android_lifecycle: dependency: "direct main" description: name: flutter_plugin_android_lifecycle sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c url: "https://pub.dev" source: hosted version: "2.0.16" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" frontend_server_client: dependency: transitive description: name: frontend_server_client sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted version: "3.2.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter source: sdk version: "0.0.0" glob: dependency: transitive description: name: glob sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted version: "2.1.2" google_maps: dependency: transitive description: name: google_maps sha256: "555d5d736339b0478e821167ac521c810d7b51c3b2734e6802a9f046b64ea37a" url: "https://pub.dev" source: hosted version: "6.3.0" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter sha256: d4914cb38b3dcb62c39c085d968d434de0f8050f00f4d9f5ba4a7c7e004934cb url: "https://pub.dev" source: hosted version: "2.5.0" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android sha256: e6cb018169e49332f88d23b1d2119b09e8ab4e7d3a1b889a1b7b3fd113e034ba url: "https://pub.dev" source: hosted version: "2.5.1" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios sha256: "2a595c9789070786c654e9772ec0d1bb759ae37d2dd776291af5398531274e06" url: "https://pub.dev" source: hosted version: "2.3.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface sha256: a3e9e6896501e566d902c6c69f010834d410ef4b7b5c18b90c77e871c86b7907 url: "https://pub.dev" source: hosted version: "2.4.1" google_maps_flutter_web: dependency: transitive description: name: google_maps_flutter_web sha256: f893d1542c6562bc8299ef768fbbe92ade83c220ab3209b9477ec9f81ad585e4 url: "https://pub.dev" source: hosted version: "0.5.4+2" graphs: dependency: transitive description: name: graphs sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted version: "2.3.1" html: dependency: transitive description: name: html sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" url: "https://pub.dev" source: hosted version: "0.15.4" http: dependency: transitive description: name: http sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted version: "1.1.0" http_multi_server: dependency: transitive description: name: http_multi_server sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" url: "https://pub.dev" source: hosted version: "4.0.2" image_picker: dependency: "direct main" description: name: image_picker sha256: "7d7f2768df2a8b0a3cefa5ef4f84636121987d403130e70b17ef7e2cf650ba84" url: "https://pub.dev" source: hosted version: "1.0.4" image_picker_android: dependency: transitive description: name: image_picker_android sha256: "0c7b83bbe2980c8a8e36e974f055e11e51675784e13a4762889feed0f3937ff2" url: "https://pub.dev" source: hosted version: "0.8.8+1" image_picker_for_web: dependency: transitive description: name: image_picker_for_web sha256: "50bc9ae6a77eea3a8b11af5eb6c661eeb858fdd2f734c2a4fd17086922347ef7" url: "https://pub.dev" source: hosted version: "3.0.1" image_picker_ios: dependency: transitive description: name: image_picker_ios sha256: c5538cacefacac733c724be7484377923b476216ad1ead35a0d2eadcdc0fc497 url: "https://pub.dev" source: hosted version: "0.8.8+2" image_picker_linux: dependency: transitive description: name: image_picker_linux sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" url: "https://pub.dev" source: hosted version: "0.2.1+1" image_picker_macos: dependency: transitive description: name: image_picker_macos sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" url: "https://pub.dev" source: hosted version: "0.2.1+1" image_picker_platform_interface: dependency: "direct main" description: name: image_picker_platform_interface sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 url: "https://pub.dev" source: hosted version: "2.9.1" image_picker_windows: dependency: transitive description: name: image_picker_windows sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" url: "https://pub.dev" source: hosted version: "0.2.1+1" integration_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" io: dependency: transitive description: name: io sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" url: "https://pub.dev" source: hosted version: "1.0.4" js: dependency: transitive description: name: js sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted version: "0.6.7" js_wrapping: dependency: transitive description: name: js_wrapping sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c url: "https://pub.dev" source: hosted version: "0.7.4" json_annotation: dependency: transitive description: name: json_annotation sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted version: "4.8.1" logging: dependency: transitive description: name: logging sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted version: "1.2.0" matcher: dependency: transitive description: name: matcher sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted version: "0.5.0" meta: dependency: transitive description: name: meta sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted version: "1.9.1" mime: dependency: "direct main" description: name: mime sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted version: "1.0.4" package_config: dependency: transitive description: name: package_config sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" url: "https://pub.dev" source: hosted version: "2.1.0" path: dependency: transitive description: name: path sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted version: "1.8.3" platform: dependency: transitive description: name: platform sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" url: "https://pub.dev" source: hosted version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.dev" source: hosted version: "2.1.6" pool: dependency: transitive description: name: pool sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" url: "https://pub.dev" source: hosted version: "1.5.1" process: dependency: transitive description: name: process sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted version: "4.2.4" pub_semver: dependency: transitive description: name: pub_semver sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 url: "https://pub.dev" source: hosted version: "1.2.3" sanitize_html: dependency: transitive description: name: sanitize_html sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" url: "https://pub.dev" source: hosted version: "2.1.0" shelf: dependency: transitive description: name: shelf sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted version: "1.4.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted version: "1.0.4" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" source_span: dependency: transitive description: name: source_span sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted version: "2.1.1" stream_transform: dependency: transitive description: name: stream_transform sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" url: "https://pub.dev" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" url: "https://pub.dev" source: hosted version: "1.2.0" sync_http: dependency: transitive description: name: sync_http sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" url: "https://pub.dev" source: hosted version: "0.3.1" term_glyph: dependency: transitive description: name: term_glyph sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 url: "https://pub.dev" source: hosted version: "1.2.1" test_api: dependency: transitive description: name: test_api sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted version: "0.6.0" timing: dependency: transitive description: name: timing sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" url: "https://pub.dev" source: hosted version: "1.0.1" typed_data: dependency: transitive description: name: typed_data sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted version: "1.3.2" vector_math: dependency: transitive description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" url: "https://pub.dev" source: hosted version: "2.1.4" video_player: dependency: "direct main" description: name: video_player sha256: "74b86e63529cf5885130c639d74cd2f9232e7c8a66cbecbddd1dcb9dbd060d1e" url: "https://pub.dev" source: hosted version: "2.7.2" video_player_android: dependency: transitive description: name: video_player_android sha256: "3fe89ab07fdbce786e7eb25b58532d6eaf189ceddc091cb66cba712f8d9e8e55" url: "https://pub.dev" source: hosted version: "2.4.10" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation sha256: "6387c2de77763b45104256b3b00b660089be4f909ded8631457dc11bf635e38f" url: "https://pub.dev" source: hosted version: "2.5.0" video_player_platform_interface: dependency: transitive description: name: video_player_platform_interface sha256: be72301bf2c0150ab35a8c34d66e5a99de525f6de1e8d27c0672b836fe48f73a url: "https://pub.dev" source: hosted version: "6.2.1" video_player_web: dependency: transitive description: name: video_player_web sha256: "2dd24f7ba46bfb5d070e9c795001db95e0ca5f2a3d025e98f287c10c9f0fd62f" url: "https://pub.dev" source: hosted version: "2.1.1" vm_service: dependency: transitive description: name: vm_service sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f url: "https://pub.dev" source: hosted version: "11.7.1" watcher: dependency: transitive description: name: watcher sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted version: "1.1.0" web: dependency: transitive description: name: web sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted version: "0.1.4-beta" web_socket_channel: dependency: transitive description: name: web_socket_channel sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted version: "2.4.0" webdriver: dependency: transitive description: name: webdriver sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" url: "https://pub.dev" source: hosted version: "3.0.2" yaml: dependency: transitive description: name: yaml sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted version: "3.1.2" sdks: dart: ">=3.1.0 <4.0.0" flutter: ">=3.13.0" ```

Steps to reproduce

  1. Create new flutter project.
  2. Copy paste code below into main.dart and import image_picker:1.0.4 package. Update pod repo and run on iOS simulator 15.4.
  3. Click FabActionButton to pick image from gallery.
  4. Code runs on all iOS versions.
  5. Now add 'google_maps_flutter: ^2.5.0' to pubspec.yaml.
  6. Update the iOS pods (delete podfile.lock, Pods folder and run repo-update).
  7. Run the project and pickImage again.
  8. Error - PlatformException(invalid_source, Invalid media source., null, null)

Expected results

Image should get picked and show in the screen.

Actual results

The code with google_maps package works on iOS 17 devices but fails on 14 and 15 versions.

Code sample

Code sample ```dart import 'dart:io'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( title: 'Image Picker Demo', home: MyHomePage(title: 'Image Picker Example'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, this.title}); final String? title; @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { File? imageFile; String? _pickImageError; final ImagePicker _picker = ImagePicker(); Future pickImage() async { try { final XFile? pickedFile = await _picker.pickImage(source: ImageSource.gallery); setState(() { imageFile = File(pickedFile!.path); }); } catch (e) { setState(() { _pickImageError = e.toString(); }); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title!), ), body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ if (imageFile != null) Image.file(imageFile!), Center(child: Text(_pickImageError ?? 'Pick Image')) ], ), floatingActionButton: FloatingActionButton( onPressed: pickImage, heroTag: 'image0', tooltip: 'Pick Image from gallery', child: const Icon(Icons.photo), ), ); } } ```

Logs

Logs ```console PlatformException(invalid_source, Invalid media source., null, null) ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale en-AE) • Flutter version 3.13.6 on channel stable at /Users/elvis/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ead455963c (12 days ago), 2023-09-26 18:28:17 -0700 • Engine revision a794cf2681 • Dart version 3.1.3 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/elvis/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/elvis/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A240d • CocoaPods version 1.13.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • 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 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.83.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.74.0 [✓] VS Code (version 1.76.2) • VS Code at /Users/elvis/Downloads/Visual Studio Code.app/Contents • Flutter extension version 3.74.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 14.0 23A344 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 117.0.5938.149 [✓] Network resources • All expected network resources are available. • No issues found! ```
darshankawar commented 1 year ago

@elvisgn Can you check this issue and this comment from it and see if it helps in your case or not ?

elvisgn commented 1 year ago

I did go through the mentioned issue, but thats about HEIC format images. In the iOS default gallery images, only 1 or 2 are HEIC, the rest have always got picked in previous versions of image_picker.

And also, if I remove the google_maps package, the same images get picked, so its definitely not a HEIC issue in my understanding.

The point to note, adding removing google_maps package should not be impacting image_picker package, right ?

darshankawar commented 1 year ago

Thanks for the update @elvisgn I followed the steps provided using the image_picker plugin example and running it using iOS simulator 15.2 with which I didn't encounter the error reported. Although I got below error while trying to pick the first left image from the gallery:

Screenshot 2023-10-10 at 12 25 36 PM

and below error:

ED96B53A/File Provider Storage/photospicker/version=1&uuid=CC95F08C-88C3-4012-9D6D-64A413D254B3&mode=compatible.jpeg, NSUnderlyingError=0x600001303ea0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

But even after adding google_maps_flutter plugin, and then selecting other images, it worked properly:

Screenshot 2023-10-10 at 12 25 51 PM

Can you also try the plugin example and see if using it, you get same error as reported ?

elvisgn commented 1 year ago

@darshankawar the sample code I pasted above was condensed from the image_plugin example. But did you add the google_maps_flutter package ?

I ran the test on the plugin now, images attached.

Plugin example without any changes

Adding google_maps_flutter package and repo-update

Screenshot 2023-10-10 at 11 16 04 AM

Plugin example re-run

elvisgn commented 1 year ago

@darshankawar I ran the same test through Xcode, getting the below error:

2023-10-10 21:52:27.819585+0400 Runner[49598:3036309] [db] _LSSchemaConfigureForStore failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x922ea487 9fee52bf 682b11e5 579b8dd8 ... d0933b90 6b0e2b01 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0xb082b236 6f967b9d 49bc2c46 a6168c59 ... 1bafd161 3b827419 }} 2023-10-10 21:52:27.819705+0400 Runner[49598:3036309] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x922ea487 9fee52bf 682b11e5 579b8dd8 ... d0933b90 6b0e2b01 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0xb082b236 6f967b9d 49bc2c46 a6168c59 ... 1bafd161 3b827419 }} 2023-10-10 21:52:27.820313+0400 Runner[49598:3036309] [db] _LSSchemaConfigureForStore failed with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x922ea487 9fee52bf 682b11e5 579b8dd8 ... d0933b90 6b0e2b01 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0xb082b236 6f967b9d 49bc2c46 a6168c59 ... 1bafd161 3b827419 }} 2023-10-10 21:52:27.820434+0400 Runner[49598:3036309] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x922ea487 9fee52bf 682b11e5 579b8dd8 ... d0933b90 6b0e2b01 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0xb082b236 6f967b9d 49bc2c46 a6168c59 ... 1bafd161 3b827419 }}

Now I'm able to find multiple existing tickets with this error, looks like an issue with M1 Macs and Simulators, but don't see a conclusive fix.

Is there a workaround?

darshankawar commented 1 year ago

It could be due to the fact that google_maps_flutter compatibility with M1. Plugin can't be marked to support arm64 until the GoogleMaps iOS SDK supports arm64 simulators https://issuetracker.google.com/issues/174841027. You may check this issue for reference: https://github.com/flutter/flutter/issues/94491 I think it'll not be in Flutter's control until the underlying native iOS sdk support.

elvisgn commented 1 year ago

@darshankawar is this only a simulator issue or I would face the same on actual devices also (I don't have a physical device at that version to test).

darshankawar commented 1 year ago

@elvisgn It should only affect simulators. Physical device should not have this issue.

github-actions[bot] commented 1 year ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] commented 1 year ago

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.