在iPhone模拟器上的哪里可以找到MyDocuments文件夹? [英] Where can I find the MyDocuments folder on iPhone Simulator?

查看:238
本文介绍了在iPhone模拟器上的哪里可以找到MyDocuments文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Xamarin.iOS应用程序的Documents文件夹中创建了一个名为 Write.txt 的文本文件.之后,我可以将其内容读取到控制台.

I created a text file named Write.txt in the Documents folder in a Xamarin.iOS app. After that I was able to read its content to the console.

var documents = 
 Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var filename = Path.Combine(documents, "Write.txt");

File.WriteAllText(filename, "Write this text into a file");
var text = File.ReadAllText(filename);

Console.WriteLine(text);  // prints out correctly

问题是,我在iPhone模拟器的文件"应用程序中找不到此文件.哪里都没有Documents文件夹,如果我搜索文件名,我不会得到任何结果.

The problem is, that I can't found this file on the iPhone simulator's Files app. There is no Documents folder anywhere, and I don't get any results if I search for the filename.

(是的,我是iOS的新手,很抱歉,如果问题很愚蠢:))

(Yes, I'm new in iOS, so sorry if the question is stupid :) )

推荐答案

请参见建设出色iOS 11中基于文档的应用程序.

如果要在文件应用中查看它,则需要在Info.plist中设置以下值:

If you want to see it in the files app, you’ll want to set the following value in your Info.plist:

  • 支持文档浏览器"(UISupportsDocumentBrowser)

  • 应用程序支持iTunes文件共享"(UIFileSharingEnabled);和
  • 支持就地打开文档"(LSSupportsOpeningDocumentsInPlace)
  • "Application supports iTunes file sharing" (UIFileSharingEnabled); and
  • "Supports opening documents in place" (LSSupportsOpeningDocumentsInPlace)

这篇关于在iPhone模拟器上的哪里可以找到MyDocuments文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆