From 2ea807077151ab913632f37bbe67d7132dbf8e61 Mon Sep 17 00:00:00 2001 From: Malik Miran <76216906+malikmiran@users.noreply.github.com> Date: Thu, 30 Jan 2025 20:50:50 +0600 Subject: [PATCH] fix(ios): downloads not working due to permission errors (#2180) * Update AppDelegate.swift store the Documents directory path which the app can then use for downloads instead of trying to create a Downloads directory * Update Info.plist should resolve the permission issues because using Documents directory instead of trying to create a Downloads directory. --------- Co-authored-by: Kingkor Roy Tirtho --- ios/Runner/AppDelegate.swift | 7 ++++++- ios/Runner/Info.plist | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index b6363034..f512ac86 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,12 +1,17 @@ import UIKit import Flutter -@main +@UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + // Add this to get Documents directory path + if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path { + UserDefaults.standard.set(documentsPath, forKey: "download_path") + } + GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ffd511a4..91b7ad94 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -72,5 +72,11 @@ _spotube._tcp + UIFileSharingEnabled + + LSSupportsOpeningDocumentsInPlace + + UISupportsDocumentBrowser + - \ No newline at end of file +