在我的WP Silverlight 8.1应用程序中,以下代码会抛出UnauthorizedAccessException,并告诉我Access被拒绝,但它在Universal Apps上运行良好。
StorageFolder storageFolder = KnownFolders.PicturesLibrary;
StorageFile file = await storageFolder.CreateFileAsync("mytest.dat", CreationCollisionOption.ReplaceExisting);
答案 0 :(得分:2)
要在Windows Phone 8.1上访问图片库,必须在package.appxmanifest文件中具有以下功能:
<Capabilities>
<Capability Name="picturesLibrary" />
</Capabilities>
答案 1 :(得分:-1)
鉴于你已经启用了ID_CAP_MEDIALIB_PHOTO,我的猜测是在WP81 Silverlight中你需要使用Microsoft.Xna.Framework.Media.MediaLibrary.SavePicture。