parent
d2ecbd3d30
commit
1479f8a8cd
|
@ -1,3 +1,6 @@
|
||||||
|
## 2.0.6
|
||||||
|
iOS: Fixes iOS 14 media picker (image & video) (#405, #407).
|
||||||
|
|
||||||
## 2.0.5
|
## 2.0.5
|
||||||
Android: Fixes [#402](https://github.com/miguelpruivo/flutter_file_picker/issues/402).
|
Android: Fixes [#402](https://github.com/miguelpruivo/flutter_file_picker/issues/402).
|
||||||
|
|
||||||
|
|
|
@ -369,8 +369,35 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls{
|
||||||
|
|
||||||
for (PHPickerResult *result in results) {
|
for (PHPickerResult *result in results) {
|
||||||
dispatch_group_enter(group);
|
dispatch_group_enter(group);
|
||||||
[result.itemProvider loadInPlaceFileRepresentationForTypeIdentifier:@"public.item" completionHandler:^(NSURL * _Nullable url, BOOL isInPlace, NSError * _Nullable error) {
|
[result.itemProvider loadFileRepresentationForTypeIdentifier:@"public.item" completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
|
||||||
[urls addObject:url];
|
|
||||||
|
if(url == nil) {
|
||||||
|
Log("Could not load the picked given file: %@", error);
|
||||||
|
dispatch_group_leave(group);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString * filename = url.lastPathComponent;
|
||||||
|
NSString * cachedFile = [NSTemporaryDirectory() stringByAppendingPathComponent:filename];
|
||||||
|
|
||||||
|
NSFileManager * fileManager = NSFileManager.defaultManager;
|
||||||
|
|
||||||
|
if([fileManager fileExistsAtPath:cachedFile]) {
|
||||||
|
[fileManager removeItemAtPath:cachedFile error:NULL];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSURL * cachedUrl = [NSURL fileURLWithPath: cachedFile];
|
||||||
|
NSError *copyError;
|
||||||
|
[NSFileManager.defaultManager copyItemAtURL: url
|
||||||
|
toURL: cachedUrl
|
||||||
|
error: ©Error];
|
||||||
|
|
||||||
|
if (copyError) {
|
||||||
|
Log("%@ Error while caching picked file: %@", self, copyError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[urls addObject:cachedUrl];
|
||||||
dispatch_group_leave(group);
|
dispatch_group_leave(group);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker
|
name: file_picker
|
||||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||||
version: 2.0.5
|
version: 2.0.6
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue