Windows phone 8.1 如何在windows phone 8.1中从相机卷获取存储文件

Windows phone 8.1 如何在windows phone 8.1中从相机卷获取存储文件,windows-phone-8.1,windows-dev-center,Windows Phone 8.1,Windows Dev Center,如何从适用于Windows phone 8.1的照相/摄像机卷中的图片创建Windows.Storage.StorageFile?我试过以下方法:- try{ Windows.Storage.StorageFolder folder = Windows.Storage.KnownFolders.CameraRoll; Windows.Storage.StorageFile file = await folder.GetFileAsync(filename); } ca

如何从适用于Windows phone 8.1的照相/摄像机卷中的图片创建Windows.Storage.StorageFile?我试过以下方法:-

try{
    Windows.Storage.StorageFolder folder = Windows.Storage.KnownFolders.CameraRoll;
    Windows.Storage.StorageFile file = await folder.GetFileAsync(filename);
   }
   catch(Exception exc) 
   {
      MessageBox.Show(exc.Message);
   }
它正在生成访问冲突异常。
有人能告诉我如何在windows phone 8.1中实现此功能吗?

首先,您可能需要在package.appxmanifest中声明此功能。

完成此操作后,现在可以使用访问图片库

这里是如何获得相机卷,你可以参考

public async Task<IEnumerable<StorageFile>> GetFilesInCameraRoll()
}


更详细的信息,您可以参考

文件名的值是多少?文件名是一个字符串。但是,异常在第一行被抛出。
return await cameraRoll.GetFilesAsync();