diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist
index 7c56964..163000d 100644
--- a/ios/Flutter/AppFrameworkInfo.plist
+++ b/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 12.0
+ 14.0
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index aa84a21..28066c9 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -3,7 +3,7 @@ import UIKit
import UniformTypeIdentifiers
@UIApplicationMain
-@objc class AppDelegate: FlutterAppDelegate {
+@objc class AppDelegate: FlutterAppDelegate, UIDocumentPickerDelegate {
var flutterResult: FlutterResult?
var directoryPath: URL!
diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift
index 904b190..fe764e2 100644
--- a/macos/Runner/AppDelegate.swift
+++ b/macos/Runner/AppDelegate.swift
@@ -34,25 +34,25 @@ class AppDelegate: FlutterAppDelegate {
}
}
- func getDirectoryPath() {
+ func getDirectoryPath() {
let openPanel = NSOpenPanel()
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.allowsMultipleSelection = false
openPanel.begin { (result) in
- if result == .OK {
- self.directoryPath = openPanel.urls.first
- if !self.directoryPath?.startAccessingSecurityScopedResource() ?? false {
- self.flutterResult?(nil)
- return
+ if result == .OK {
+ self.directoryPath = openPanel.urls.first
+ if let directoryPath = self.directoryPath, !directoryPath.startAccessingSecurityScopedResource() {
+ self.flutterResult?(nil)
+ return
+ }
+ self.flutterResult?(self.directoryPath?.path)
+ } else {
+ self.flutterResult?(nil)
}
- self.flutterResult?(self.directoryPath?.path)
- } else {
- self.flutterResult?(nil)
- }
}
- }
+ }
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true