简体   繁体   English

如何使用 Xamarin iOS 将 UIImage 存储到 iPhone 的应用程序文件夹中?

[英]How to store a UIImage into iPhone's App Folder with Xamarin iOS?

For android, there will be an application folder exist in File Manager -> Phone Storage -> data-> App Package Name where I can save some images inside and it is very easy to find and view from outside without opening the app.对于android,文件管理器-> 手机存储-> 数据-> 应用程序包名称中将存在一个应用程序文件夹,我可以在其中保存一些图像,并且无需打开应用程序即可从外部轻松查找和查看。 I can easily view the images save inside the folder by browsing through File Manager.我可以通过浏览文件管理器轻松查看保存在文件夹中的图像。 However, it seems like iPhone didn't provide such function to let user store images into the Application Folder.但是,iPhone 似乎没有提供让用户将图像存储到应用程序文件夹中的功能。 I can't even find the similar app like File Manager provided by Android in iPhone.我什至在 iPhone 中找不到 Android 提供的类似文件管理器这样的应用程序。 Any iPhone user here?这里有 iPhone 用户吗? Please tell me the what is the correct path to save image in iPhone and I can view it from outside.请告诉我在 iPhone 中保存图像的正确路径是什么,我可以从外面查看。 Normally, I will set the image path as "storage/emulated/0/data/AppPackageName/AppImage" for android.通常,我会将 android 的图像路径设置为“storage/emulated/0/data/AppPackageName/AppImage”。 How about iPhone? iPhone呢? Thanks in advance for any help.在此先感谢您的帮助。 And the most important is where can I browse through the saved image in iPhone?最重要的是我可以在哪里浏览 iPhone 中保存的图像?

Here is a doc about File system access in Xamarin.iOS .这是有关Xamarin.iOS 中文件系统访问的文档

Normally, I will set the image path as "storage/emulated/0/data/AppPackageName/AppImage" for android.通常,我会将 android 的图像路径设置为“storage/emulated/0/data/AppPackageName/AppImage”。 How about iPhone? iPhone呢?

iOS has sandbox in Application , it's the same as Android with path ' storage/emulated/0/data/AppPackageName/AppImage ' . iOS 在 Application 中沙箱,它与 Android 相同,路径为 ' storage/emulated/0/data/AppPackageName/AppImage ' 。 However it can not be detected outside the Application, only exposed inside App .但是在 Application 之外无法检测到,只能在 App 内部暴露。

Your application's access to the file system (and other resources such as the network and hardware features) is limited for security reasons.出于安全原因,您的应用程序对文件系统(以及其他资源,如网络和硬件功能)的访问受到限制。 This restriction is known as the Application Sandbox .此限制称为应用程序沙箱 In terms of the file system, your application is limited to creating and deleting files and directories in its home directory.在文件系统方面,您的应用程序仅限于在其主目录中创建和删除文件和目录。

And the most important is where can I browse through the saved image in iPhone?最重要的是我可以在哪里浏览 iPhone 中保存的图像?

If you need to browse the saved file in iPhone , maybe you need Sharing with the Files app .如果您需要在 iPhone 中浏览保存的文件,也许您需要使用“文件”应用程序共享

iOS 11 introduced the Files app - a file browser for iOS that allows the user to see and interact with their files in iCloud and also stored by any application that supports it. iOS 11 引入了文件应用程序 - 一种适用于 iOS 的文件浏览器,允许用户查看 iCloud 中的文件并与之交互,并且还可以存储在任何支持它的应用程序中。

You can refer to above doc to know how to implement it in iOS .I think it's not conveniently to do the same thing as Android in iOS .你可以参考上面的文档了解如何在iOS中实现它。我认为在iOS中做与Android相同的事情并不方便。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM