我试图在hololens上创建一个应用程序,该应用程序创建并写入文本文件以记录来自用户的输入。目前,我试图制作文件并从文件资源管理器或一个驱动器访问它。这是我的方法:在hololens上创建txt文件
public void createFile()
{
#if WINDOWS_UWP
Task task = new Task(
async() =>
{
testText.text="hi";
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
StorageFile textFileForWrite = await storageFolder.CreateFileAsync("Myfile.txt");
});
task.Start();
task.Wait();
#endif
}
这基本上是我在这里找到:https://forums.hololens.com/discussion/1862/how-to-deploy-and-read-data-file-with-app,但是当我尝试运行方法,在hololens应用程序冻结了一会儿,然后关闭。代码有问题吗?任何想法是怎么回事? 在此先感谢
执行此操作:Project - > Properties - > Debug。在“调试器类型”下更改为“混合”。这应该阻止应用程序因抛出异常而关闭,从而允许您检查它。 – Draco18s
@Draco18s的建议我很好。另外,请检查Hololens Device Portal是否已成功创建此文件。还捕获崩溃转储,参考:https://developer.microsoft.com/en-us/windows/mixed-reality/using_the_windows_device_portal#file_explorer和https://developer.microsoft.com/en-us/windows/mixed-reality/using_the_windows_device_portal#app_crash_dumps –