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

Unable to pick photos from Gallery on iOS simulator #92

Closed
joeykang opened this issue Feb 1, 2022 · 14 comments
Closed

Unable to pick photos from Gallery on iOS simulator #92

joeykang opened this issue Feb 1, 2022 · 14 comments
Labels
bug Something isn't working

Comments

@joeykang
Copy link

joeykang commented Feb 1, 2022

Description

I'm able to pick photos from Gallery when running on iOS simulator.

Actual Behavior

OpenReadAsync() throws an exception like below.

Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.jpeg" UserInfo={NSLocalizedDescription=Cannot load representation of type public.jpeg, NSUnderlyingError=0x600002006a90 {Error Domain=NSCocoaErrorDomain Code=256 "The file “version=1&uuid=B84E8479-475C-4727-A4A4-B77AA9980897&mode=compatible.jpeg” couldn’t be opened." UserInfo={NSURL=file:///Users/joey/Library/Developer/CoreSimulator/Devices/D004FFB9-AEC8-46F5-BDCE-67F4392FF633/data/Containers/Shared/AppGroup/40F09F17-AF44-4239-A0B8-B26FC04C9BD9/File%20Provider%20Storage/photospicker/version=1&uuid=B84E8479-475C-4727-A4A4-B77AA9980897&mode=compatible.jpeg, NSFilePath=/Users/joey/Library/Developer/CoreSimulator/Devices/D004FFB9-AEC8-46F5-BDCE-67F4392FF633/data/Containers/Shared/AppGroup/40F09F17-AF44-4239-A0B8-B26FC04C9BD9/File Provider Storage/photospicker/version=1&uuid=B84E8479-475C-4727-A4A4-B77AA9980897&mode=compatible.jpeg, NSUnderlyingError=0x60000207f8a0 {Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)"}}}}

Expected behavior

Stream should be returned with OpenReadAsync()

Steps to reproduce the behavior

  1. await MediaGallery.PickAsync()
  2. OpenReadAsync()

Screenshots or Videos

Reproduction Link

Configuration

  • Device: iPhone 12 mini simulator
  • OS Version: iOS 15.2
  • Plugin Version: 2.1.1
  • Framework: Xamarin 5
  • Xcode: 13.2.1
@joeykang joeykang added the bug Something isn't working label Feb 1, 2022
@dimonovdd
Copy link
Owner

#56

@joeykang
Copy link
Author

joeykang commented Feb 3, 2022

The suggestion in #56 did not work on my end. Even if I pick a photo downloaded with Safari on simulator it returns the same exception. Wonder if this could be a simulator issue running on M1 Mac.

@dimonovdd
Copy link
Owner

This issue is on Apple's side. We won't be able to solve it. Try writing to Apple

@nicjay
Copy link

nicjay commented Jul 26, 2022

I know this is closed, but thought it was worth mentioning the Essentials MediaPicker version of OpenReadAsync() does work without issue on the simulator. I don't know yet how the implementations differ, but I also wasn't able to find any workaround to avoid this crash with MediaGallery, even emptying the gallery and downloading fresh images with Safari. I cannot use a real device to test, so the Essentials verson works for now.

@dimonovdd
Copy link
Owner

@nicjay hi. Sorry, I haven't seen your messages
MediaGallery uses new PHPicker, Essentials uses outdated UIImagePicker.

Do you get the same error as in the description?

@nicjay
Copy link

nicjay commented Aug 4, 2022

@dimonovdd Yes, identical error.

@dimonovdd
Copy link
Owner

You can check in google: this error is really on apple's side

@eddieyanez
Copy link

I have the same problem on the latest version of Xcode and the iOS simulator. Has anyone found a workaround since then by any chance?

@dimonovdd
Copy link
Owner

@eddieyanez Hi. Apparently apple still hasn't fixed it

https://developer.apple.com/forums/thread/658135

@eddieyanez
Copy link

@eddieyanez Hi. Apparently apple still hasn't fixed it

https://developer.apple.com/forums/thread/658135

That really sucks! Do you happen to know if the outdated UIImagePicker allows multiple image selection?

@dimonovdd
Copy link
Owner

UIImagePicker allows multiple image selection?

No

@dimonovdd
Copy link
Owner

There is a workaround:

You can save any image from Safari on simulator. The Picker will work good with such images

@eddieyanez
Copy link

I've actually tried it and it didn't work for me. I still introduced the nugget into the codebase, but couldn't get past it on Android, therefore I removed the code in the end. Happy to give it another go and have a look if you find it would be useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants