【发布时间】:2012-10-25 02:50:18
【问题描述】:
我有以下代码
// Point to c:\users\yancheng\documents\visual studio 2012\Projects\App5\App5\bin\x86\Debug\AppX
StorageFolder storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await storageFolder.CreateFileAsync("1000.txt");
if (file != null)
{
using (IRandomAccessStream writeStream = await file.OpenAsync(FileAccessMode.ReadWrite))
{
using (DataWriter dataWriter = new DataWriter(writeStream))
{
dataWriter.WriteInt32(1000);
}
}
}
我已通过Package.appxmanifest 启用所有权限。但是,我不确定为什么在storageFolder.CreateFileAsync 期间我仍然收到UnauthorizedAccessException。
还有什么我错过的吗?
【问题讨论】:
标签: c# windows-8 windows-store-apps microsoft-metro