fix(iOS): 🐛 Image Picker to Handle Partial Failures Gracefully #1639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Currently, the iOS image picker fails entirely if any single image fails to process, causing a poor user experience.
Error:
PlatformException(file_picker_error, Temporary file could not be created, Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.item" UserInfo={NSLocalizedDescription=Cannot load representation of type public.item, NSUnderlyingError=0x303587d50 {Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with a helper application." UserInfo={NSUnderlyingError=0x303572be0 {Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 18859 named (null) was invalidated." UserInfo={NSDebugDescription=The connection to service with pid 18859 named (null) was invalidated.}}}}}, null)
Solution
Updated the PHPicker implementation to:
Key changes:
Testing
Tested scenarios:
Impact
Users can now select multiple images and get results even if some images fail to process, rather than losing all selected images due to a single failure.