我想使用StorageFile来实现Reading&写作如此处所见
http://msdn.microsoft.com/en-us/library/windows/apps/hh758325.aspx#writing_to_a_file
使用
public async void Save()
{
StorageFolder storageFolder = KnownFolders.DocumentsLibrary;
StorageFile sampleFile = await storageFolder.CreateFileAsync(PlayerPrefs.GetString("WorldName") +"_"+filename);
await Windows.Storage.FileIO.WriteTextAsync(sampleFile, "Swift as a shadow");
}
但是“await”行给出了异常
+ $exception {Cannot evaluate expression because a native frame is on top of the call stack.} System.Exception {System.UnauthorizedAccessException}
如果这有任何不同,我将在Windows 8商店中使用Unity。
任何人都知道这里的问题是什么?
答案 0 :(得分:1)
Cannot evaluate expression because a native frame is on top of the call stack
这只告诉我们线程正在执行unmanaged code,因此无法评估表达式。
真正的错误是System.UnauthorizedAccessException
。
打开 Package.appxmanifest ,转到功能标签,然后检查文档库访问。
答案 1 :(得分:0)
只需创建测试证书并在解决方案属性的“签名”选项中选中“对ClickOnce清单进行签名”,然后在解决方案资源管理器中右键单击解决方案名称即可。