Windows phone 8.1 Windows Phone 8.1 FileIO.WriteTextAsync访问被拒绝

Windows phone 8.1 Windows Phone 8.1 FileIO.WriteTextAsync访问被拒绝,windows-phone-8.1,Windows Phone 8.1,我在InstalledLocation中有一个文件。我想给这个文件写一些文字。当我从VisualStudio运行时,我的设备没有问题,我可以写入或读取文件。但当我从应用商店安装应用程序时,我无法编写。出现“访问被拒绝”的错误。(来自HRESULT的异常:0x80070005(E_ACCESSDENIED))' 我查看了Package.appxmanifest中的capabilites部分,但没有看到类似“write,readauthority”之类的内容 请参阅下面的代码 StorageFi

我在InstalledLocation中有一个文件。我想给这个文件写一些文字。当我从VisualStudio运行时,我的设备没有问题,我可以写入或读取文件。但当我从应用商店安装应用程序时,我无法编写。出现“访问被拒绝”的错误。(来自HRESULT的异常:0x80070005(E_ACCESSDENIED))'

我查看了Package.appxmanifest中的capabilites部分,但没有看到类似“write,readauthority”之类的内容

请参阅下面的代码

  StorageFile htmlFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("mobile.html");

  await FileIO.WriteTextAsync(htmlFile, form.MobileHtml);  // I am receiving error here. 

这是预期的行为。你的应用程序没有对其安装位置的写入权限。而是将可编辑数据写入应用程序数据文件夹(ApplicationData.Current.LocalFolder或RoamingFolder)

不幸的是,由于从VisualStudio安装用于测试的应用程序的方式,它们确实获得了写访问权限