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

Fix Issue 1367 #1475

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 8.0.1
### iOS
- fix [1367](https://github.com/miguelpruivo/flutter_file_picker/issues/1367)

## 8.0.0+1
Removes linter warnings and fixes CI/CD.

Expand Down
13 changes: 9 additions & 4 deletions ios/Classes/FilePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ @interface FilePickerPlugin()
@property (nonatomic) BOOL allowCompression;
@property (nonatomic) dispatch_group_t group;
@property (nonatomic) BOOL isSaveFile;
@property (nonatomic) MediaType type;
@end

@implementation FilePickerPlugin
Expand Down Expand Up @@ -221,7 +222,9 @@ - (void)resolvePickDocumentWithMultiPick:(BOOL)allowsMultipleSelection pickDirec

#ifdef PICKER_MEDIA
- (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withCompressionAllowed:(BOOL)allowCompression {


self.type = type;

#ifdef PHPicker
if (@available(iOS 14, *)) {
PHPickerConfiguration *config = [[PHPickerConfiguration alloc] init];
Expand Down Expand Up @@ -501,16 +504,18 @@ -(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPicke
}

__block NSError * blockError;


bool isImageSelection = self.type == IMAGE;
NSString * utiType = isImageSelection ? @"public.image" : @"public.audiovisual-content";

for (NSInteger index = 0; index < results.count; ++index) {
[urls addObject:[NSURL URLWithString:@""]];

dispatch_group_enter(_group);

PHPickerResult * result = [results objectAtIndex: index];

[result.itemProvider loadFileRepresentationForTypeIdentifier:@"public.item" completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {

[result.itemProvider loadFileRepresentationForTypeIdentifier:utiType completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
if(url == nil) {
blockError = error;
Log("Could not load the picked given file: %@", blockError);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
repository: https://github.com/miguelpruivo/flutter_file_picker
issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues
version: 8.0.0+1
version: 8.0.1

dependencies:
flutter:
Expand Down