[英]How to Flutter write files to iOS iPhone “Find on my phone” Folder
My goal is to allow my app user write and read files created by my app.我的目标是允许我的应用用户写入和读取由我的应用创建的文件。 For example, write and then allow the user to email a.CSV file of data, or a.GPX file of location data.
例如,写入然后允许用户到 email 一个.CSV 文件的数据,或者一个.GPX 文件的位置数据。 And on the other end, import a file back into my application.
另一方面,将文件导入回我的应用程序。
I have successfully deployed an Android version of my app (Plant List GPS) which uses Flutter plugin path_provider 1.6.10.我已经成功部署了我的应用程序(植物列表 GPS)的 Android 版本,它使用 Flutter 插件 path_provider 1.6.10。 On Android, I successfully use external directories, but this external directories solution is not available/allowed for iOS.
在 Android 上,我成功使用了外部目录,但是对于 iOS,此外部目录解决方案不可用/不允许。 I find on iOS I can create subfolders and write to the getApplicationDocumentsDirectory, but when I try to find/read that file from a file picker solution, it cannot be seen.
我在 iOS 上找到我可以创建子文件夹并写入 getApplicationDocumentsDirectory,但是当我尝试从文件选择器解决方案中查找/读取该文件时,它看不到。 I understand this is proper behavior to protect sensitive app files in this folder location.
我了解这是保护此文件夹位置中敏感应用程序文件的正确行为。
I also understand that iOS has the concept of an app Sandbox and appreciate its objectives.我也了解 iOS 具有应用程序沙盒的概念并欣赏其目标。 I'm not trying to defeat it, but find a way to access/use it in my Flutter app.
我不是想打败它,而是想办法在我的 Flutter 应用程序中访问/使用它。 I have played around in writing test data files to various places on the iOS file system using the iPhone 11 simulator on my MacBook, but can not get any file to appear in the phone "Find on my phone" dialog.
我曾在我的 MacBook 上使用 iPhone 11 模拟器将测试数据文件写入 iOS 文件系统上的各个位置,但无法让任何文件出现在手机“在我的手机上查找”对话框中。
Any help in solution approach or technique is appreciated.感谢您对解决方案方法或技术的任何帮助。
I think you need to add both the keys into info.plist, and then files from your app directory will be visible on Files app!我认为您需要将两个密钥都添加到 info.plist 中,然后您的应用程序目录中的文件将在 Files 应用程序上可见! LSSupportsOpeningDocumentsInPlace UIFileSharingEnabled
LSSupportsOpeningDocumentsInPlace UIFileSharingEnabled
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.