Access is denied error windows phone 8

China☆狼群 提交于 2019-12-11 05:56:55

问题


I am getting error on following line

StorageFolder picturesFolder = KnownFolders.PicturesLibrary;

Exception is: ex {System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Windows.Storage.KnownFolders.get_PicturesLibrary() at WinTooth.MainPage.d__0.MoveNext()} System.SystemException {System.UnauthorizedAccessException}

I have also added lines to register for a file association extension. Please suggest/help.


回答1:


http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.knownfolders.pictureslibrary says Windows Phone 8: This API is not intended to be used directly from your code.

In my app I used

             var photoChooserTask = new PhotoChooserTask();
             photoChooserTask.Completed += OnPhotoChooserTask_Completed;
             photoChooserTask.Show();

to pick a photo.




回答2:


I was having same problem but my issue was that i was reading too much files using iBuffer so it was taking too much memory and it was causing out of memory issue. So i optimized it and this issue was fixed.



来源:https://stackoverflow.com/questions/19379937/access-is-denied-error-windows-phone-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!