Closed monsieurtanuki closed 4 years ago
I wasn't able to get this issue, but there was actually one issue with the picker for iOS 14 that I've already addressed. Would you mind to please check 2.0.1+2? Thank you!
I tried again with 2.0.1+2
but it didn't work: same message.
I also tried on another simulator: iPad Pro (12.9-inch) - 4th generation
.
Maybe similar to https://developer.apple.com/forums/thread/659384
@monsieurtanuki theres yet too little information about this online. I can't seem to find a reliable example, I'll have to dig it a bit more.
Is there a way I or you can put extra print statements in your code in order to understand what's wrong?
@monsieurtanuki building with Xcode should be enough. You can put it from there (navigate through Pods until file_picker).
@miguelpruivo I don't know anything about Xcode / swift. Could you point me to the right direction, I would like to do something like this in order to trace each step in flutter:
- (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withCompressionAllowed:(BOOL)allowCompression {
Print("Hi there!"); // something like that <<<
if (@available(iOS 14, *)) {
PHPickerConfiguration *config = [[PHPickerConfiguration alloc] init];
config.filter = type == IMAGE ? [PHPickerFilter imagesFilter] : type == VIDEO ? [PHPickerFilter videosFilter] : [PHPickerFilter anyFilterMatchingSubfilters:@[[PHPickerFilter videosFilter], [PHPickerFilter imagesFilter]]];
@monsieurtanuki it's not the easiest thing to do, you'll need to go through Pods (see screenshot) and add debug code there.
Since it's made with Objective-C you can't use print()
, you'll have to do Log("Something");
If you want to print out variables you can do Log("My variable %@", foo);
@miguelpruivo I know that what I do has an impact on the actual executed code - I managed to add crashes here and there in Objective-C, but I cannot see where the Log
is supposed to be printed. Not in the flutter "Run" tab obviously.
Crashes and logs are printed on the right window. Make sure it's visible.
@miguelpruivo I could find a right window, that stayed desperately blank (but black). Life is short: if I started to learn flutter it's not to have to learn dev on iOS later on. Plus, even if I manage one day to display my logs, that doesn't mean that something relevant will come out of it. I pause for the moment. Thinking about rolling back to Xcode 11.
@monsieurtanuki rolling back will prevent you from building to iOS 14.
As I’m the only maintainer I have to take a further look into this on my off hours. I’m sorry for any inconvenience, I’ll do my best as soon as I can to fix this.
@miguelpruivo Oh, nothing personal. It's just that initially I developed apps on Android, then I wanted to develop apps on iOS too, and I literally spent (wasted?) months about that. And I was about to deliver a production version of my app this week. I'm angry with iOS, and Apple in general.
Thanks for your library anyway, and I hope that very soon the issue will be fixed! And I know how frustrating it can be when someone reports a bug that you cannot reproduce ;)
This is an urgent issue, so I’ll try to fix it ASAP. Don’t worry. :)
Any updates on the invalid path for picking an image? I'm using FileType.media to display an image widget and getting this error (which seems slightly different from issue #406 's error):
flutter: The following FileSystemException was thrown resolving an image codec:
flutter: Cannot open file, path =
flutter: '/Users/tanay/Library/Developer/CoreSimulator/Devices/E1360B1E-CCF0-4631-96FD-E5FC4C105875/data/Containers/Shared/AppGroup/06C1595B-83FD-4CA1-8503-97F861336B56/File Provider Storage/photospicker/version=1&uuid=CCAF61BC-7527-4D9F-8A7F-62183CDB33B0&mode=compatible.png' (OS
flutter: Error: No such file or directory, errno = 2)
Don't know what the version, uuid, and mode parameters mean/are there for but maybe it can help find the issue?
@tneotia this is still WIP, I’ll keep you updated.
Please, check #405 answer and let me know if it's working now.
@miguelpruivo The interface is slightly different, but I still cannot see any file:
And I can see pictures with the "Photos" app:
Could it be that with the new system you cannot see the pics on your iPhone, but only the ones in iCloud? (I don't use iCloud)
@monsieurtanuki it seems that right now it isn't loading the photos picker... Is your filetype set to FileType.media? That's what I use to open just the image picker rather than files picker.
@monsieurtanuki what is the FileType
that you are using? Have you tried FileType.image
? Weird that with me it works perfectly, both on simulator and my iPhone.
Correction: what I've just described in my previous comment was without any file type (same as with FilePicker.platform.pickFiles(type: FileType.any)
).
If I use FileType.image
or FileType.media
, I get the same "Picker Unavailable" as previously:
That's strange... I haven't tested with the new branch but previously the picker was showing for me, just my app was unable to open the image from the path with the error I commented above. @miguelpruivo I will update you with my findings in 30min-1hr - I don't have a physical device so I can only test on simulator.
@monsieurtanuki using FileType.any
opens document picker which does rely on iCloud, that's correct.
Using FileType.image
or media
will open gallery. Weird that you get Picker Unavailable. I can't seem to be able to replicate it. 😞
using FileType.any opens document picker which does rely on iCloud, that's correct.
@miguelpruivo Just curious: is that typical apple non-sense, that any
does not include images that are on the smartphone but not in the cloud?
Using FileType.image or media will open gallery. Weird that you get Picker Unavailable. I can't seem to be able to replicate it. 😞
@tneotia said "it seems that right now it isn't loading the photos picker", which would match what I experience. Currently trying with another simulator...
@monsieurtanuki Apple does not have a typical file explorer like Android. I mean, it actually does, it's the Files app that ships with iOS. However, it mostly relies on iCloud documents (or any other provider such GDrive, Dropbox etc.) and/or local documents if you already have saved there. You can't navigate thought directories and such, like on Android. So yes, you can assume that it being empty on the simulator is the most normal thing to see.
When I try with the plugin's example app and my own iPhone (iOS 14) it works properly (and I have more than 10k media on my iPhone). Could it be something else? Does that happen with the example app?
@miguelpruivo Working great for me! I can see files, and once I select there are no errors, shown just fine in image widget.
@tneotia great! I just need to find out what's failing for @monsieurtanuki. 😞
@miguelpruivo I am getting this when running on IOS 14. It didn't ask me permission to Select Specific Photos
which is introduced in IOS 14 I guess. However ImagePicker
plugin seems to be working fine with IOS 14. FYI, it is asking for this new permission.
════════ Exception caught by image resource service ════════════════════════════════════════════════
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = '/Users/birju.vachhani/Library/Developer/CoreSimulator/Devices/3DCF6DAE-50A7-4154-A108-E2EAAFF17D15/data/Containers/Shared/AppGroup/5A82E33B-04A3-4D5B-9BA3-E4F505DAF1E9/File Provider Storage/photospicker/version=1&uuid=EC8E451D-0352-4861-AA44-8B7A91C49983&mode=compatible.jpeg' (OS Error: No such file or directory, errno = 2)
When the exception was thrown, this was the stack:
#0 _File.open.<anonymous closure> (dart:io/file_impl.dart:356:9)
(elided 13 frames from dart:async)
Path: /Users/birju.vachhani/Library/Developer/CoreSimulator/Devices/3DCF6DAE-50A7-4154-A108-E2EAAFF17D15/data/Containers/Shared/AppGroup/5A82E33B-04A3-4D5B-9BA3-E4F505DAF1E9/File Provider Storage/photospicker/version=1&uuid=EC8E451D-0352-4861-AA44-8B7A91C49983&mode=compatible.jpeg
════════════════════════════════════════════════════════════════════════════════════════════════════
@BirjuVachhani iOS 14 introduced a new framework that prevents users from being asked permission if privacy isn't compromised. This is, it uses a different process (native gallery) to let users pick whatever they want and then return the result to the Flutter app. This provides a better user experience than actually asking permissions if they aren't required. You can read more about it here.
Image Picker, on the other hand, is "running" from this as it requires a more complex implementation, so they are just preventing crashes from happening and keeping the old image controller (I've been following the thread as well).
Update to:
file_picker: 2.0.6
Let me know if it worked for you.
@miguelpruivo This makes much more sense now. I'll try this and will surely let you know.
@miguelpruivo T
@BirjuVachhani iOS 14 introduced a new framework that prevents users from being asked permission if privacy isn't compromised. This is, it uses a different process (native gallery) to let users pick whatever they want and then return the result to the Flutter app. This provides a better user experience than actually asking permissions if they aren't required. You can read more about it here.
Image Picker, on the other hand, is "running" from this as it requires a more complex implementation, so they are just preventing crashes from happening and keeping the old image controller (I've been following the thread as well).
Currently you are getting that exception because I haven't yet published a version fully functional, but you can give it a try by replacing your file_picker with:
file_picker: git: url: https://github.com/miguelpruivo/flutter_file_picker ref: fix/ios14-picker
Let me know if it worked for you.
@miguelpruivo This worked perfectly for me.
@BirjuVachhani good to know. I'll probably publish a new version with it later today.
@miguelpruivo That sounds great. I have a production release tomorrow so I am really looking forward to it.
Currently you are getting that exception because I haven't yet published a version fully functional, but you can give it a try by replacing your file_picker with:
file_picker: git: url: https://github.com/miguelpruivo/flutter_file_picker ref: fix/ios14-picker
Works like a charm!
(I tried it using FileType.image)
@BirjuVachhani iOS 14 introduced a new framework that prevents users from being asked permission if privacy isn't compromised. This is, it uses a different process (native gallery) to let users pick whatever they want and then return the result to the Flutter app. This provides a better user experience than actually asking permissions if they aren't required. You can read more about it here.
Image Picker, on the other hand, is "running" from this as it requires a more complex implementation, so they are just preventing crashes from happening and keeping the old image controller (I've been following the thread as well).
Currently you are getting that exception because I haven't yet published a version fully functional, but you can give it a try by replacing your file_picker with:
file_picker: git: url: https://github.com/miguelpruivo/flutter_file_picker ref: fix/ios14-picker
Let me know if it worked for you.
Works 💯 %
Deployed with 2.0.6. You can now update your dependency to file_picker: 2.0.6
.
@monsieurtanuki having your issue is still preventing me from closing this as it seems a bit different, however, couldn't find any possible way to replicate it. 😞 If you manage to create a simple project with all the steps, that'd be great!
Deployed with 2.0.6. You can now update your dependency to
file_picker: 2.0.6
.@monsieurtanuki having your issue is still preventing me from closing this as it seems a bit different, however, couldn't find any possible way to replicate it. 😞 If you manage to create a simple project with all the steps, that'd be great!
@miguelpruivo great work! Thanks a lot. I'll try it out asap...
@miguelpruivo I've created the simplest project: https://github.com/monsieurtanuki/picker_unavailable If I click on the "+" button, I get the already mentioned "Picker Unavailable" message.
@monsieurtanuki thank you, all try that as soon as possible.
@miguelpruivo I tested it and it works like a charm! ❤️
Thanks @miguelpruivo for your time and effort.
Using version file_picker: 2.0.6
and works fine.
Side note about a possible bug in the iOS simulator:
I noticed that the iOS simulator has issues when selecting HDR images. The flutter_picker package will return no element found
. Though the problem seems to be from the simulator. In iPhone 11 Max (iOS 14), when I try to edit an HDR image inside the Photos app, the app shows a black background or just crashes. Just in case someone runs into the same issue, check if the photo is editable inside the Photos app.
@OsaXma nice finding! Indeed I have noticed that HDR pictures from simulator can’t be loaded, but on physical device it worked just fine, so I ignored it, since I can assume it must be a simulator issue. But after your finding, it turns out it’s probably an iOS 14 issue when loading HDR assets (which is required when you edit in your photos app).
@monsieurtanuki with your sample, it showed briefly (1 second I'd say) the Picker unavailable message but then it loaded the content immediately.
It seems that there is some issue regarding PHPicker on iOS itself and it was also reported recently here.
I believe that if you remove the Xcode derived data and run a full clean, it should work properly (or in a different simulator).
@miguelpruivo I tried again and again, by cleaning, with a different Simulator, but I still get the "Picker Unavailable" message - and nothing more even one minute after.
Two remarks:
Deintegrating `Runner.xcodeproj`
Deleted 1 'Check Pods Manifest.lock' build phases.
Deleted 1 'Embed Pods Frameworks' build phases.
- Pods_Runner.framework
Deleting Pod file references from project
- Pods-Runner.debug.xcconfig
- Pods-Runner.release.xcconfig
- Pods-Runner.profile.xcconfig
Deleted 1 empty `Pods` groups from project.
Deleted 1 empty `Frameworks` groups from project.
Removing `Pods` directory.
Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
Analyzing dependencies
Downloading dependencies
Installing DKImagePickerController (4.3.2)
Installing DKPhotoGallery (0.0.17)
Installing Flutter (1.0.0)
Installing SDWebImage (5.8.3)
Installing SwiftyGif (5.3.0)
Installing file_picker (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 6 total pods installed.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
@monsieurtanuki that warning is "normal" and it's always there unless a custom configuration is provided (from your app) but that isn't required.
Using iOS 13 style on iOS 14 could result in unexpected crashes (hence the image_picker issue — from iOS 14 and later, devs should use PHPicker which is more reliable and offers more options such as a search bar). However, you shouldn't and you can't get that issue. I'm surprised that you do. There must be something in your setup that's resulting in that but I didn't figure what yet because you seem to be the only one with that.
Do you have a real device where you can test?
@miguelpruivo OK for your comments about the warning message and the irrelevancy of iOS 13 settings on iOS 14.
I don't have an actual iPhone to test it on, though I know it's part of the sick Apple business model to force developers to buy a Mac and an iPhone. I managed to get a Mac from a friend, I managed to use a friend's iPad for the once-in-a-lifetime account set-up in Xcode, but that's it for me. And even if I managed to borrow temporarily an iPad for tests about this current issue, I would need one later for everything else in my app that needs the selected picture.
Obviously you cannot do anything about iOS 14 bugs. Thanks for your help anyway, and feel free to close this issue.
@monsieurtanuki I'm sorry that I couldn't help you much further than this. 😞 Let me know if you come up with a solution as I'm interested to know what could be potentially causing it.
If anyone experience the same issue reported by OP, please feel free to reopen this.
Thank you!
@miguelpruivo I hate to reopen this but I pushed a build to TestFlight today and my tester had a crash when opening from gallery. It's super long, but here it is:
I looked this up and some people point to it being some sort of memory leak, but I can't find anything related to this and PHPicker. Or is this a problem in my app rather than the plugin?
Hi @tneotia, I don’t actually see anything there related to the plugin itself. Might be something else with the app or any other plugin. 😞
Alright, thanks! I'll try to look into it but I don't have much experience reading swift logs
@miguelpruivo I looked into it a little today and here's how to reproduce it:
1) Use filetype.image or filetype.media 2) have a button to open the picker and just keep spamming it with touches 3) the button opens the picker and while you are still spamming a photo will get selected and then the app crashes immediately
I don't know if this will be reproducible on the example app or if there is something specific in the way I am using the image that is causing the app to crash, but could you see if you are able to reproduce this using the method above? Or anyone else if they would like as well.
Edit: Cloned source and was able to reproduce on example app as well. Same method as above, on dropdown choose media or image and then spam the file picker button.
Describe the bug cf. https://github.com/flutter/flutter/issues/65995 I created a brand new project from scratch and I still get the following message:
Issue details
FilePicker.platform.pickFiles(type: FileType.image)
andFilePicker.platform.pickFiles(type: FileType.image, allowMultiple: true)
Screenshots and/or video
Screenshot
![Simulator Screen Shot - iPhone 8 Plus - 2020-09-23 at 12 22 42](https://user-images.githubusercontent.com/11576431/94000730-dc87d580-fd97-11ea-8317-2b2245363c95.png)Flutter Version details
flutter doctor -v
``` [✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.5 19F101, locale fr-FR) • Flutter version 1.20.4 at /Users/fabricefontaine/development/flutter • Framework revision fba99f6cf9 (9 days ago), 2020-09-14 15:32:52 -0700 • Engine revision d1bc06f032 • Dart version 2.9.2 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/fabricefontaine/Library/Android/sdk • Platform android-30, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 12.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.0, Build version 12A7209 • CocoaPods version 1.9.3 [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 49.0.2 • Dart plugin version 193.7547 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] Connected device (1 available) • iPhone 8 Plus (mobile) • 755F3CBA-6DA9-4C91-B05A-2CD42DF86E65 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator) • No issues found! ```