简体   繁体   中英

Access is denied error windows phone 8

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM