Need help with file system access in iOS from Xamarin.Forms app

LMiles 6 Reputation points


I have recently updated my plugin libraries - specifically Xamarin.Forms from build to
AND Xamarin.Essentials build to 1.6.1

Prior to the update, this code WAS working AND I could go into the Files app and find the files created by my app under a folder with my app name.

        //NOTE - .pngs and .pdfs get saved to the app folder in FILES.   
        public async void SavePNG(byte[] pngByte, string fileName)  
            await SetPermissions(); //gets/sets permissions to access file-storage  
            if (Status == PermissionStatus.Granted)  
                    var filePath = Path.Combine(GetDocumentsPath(), fileName);  
                    // save the data to a stream  
                    using (var stream = File.OpenWrite(filePath))  
                        stream.Write(pngByte);    //create the .png file                      
                catch (Exception ex)  

            public string GetDocumentsPath()  
                return = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); //was visible to the user in Files (iOS)  


This is also set in the info.plist:

LSSupportsOpeningDocumentsInPlace boolean Yes

I have double checked information in this link:

if I put a breakpoint in and get the filepath var once it is set, it is this:

That GUID in the path is wrong methinks.
This Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) is no longer returning the correct path.

This has broken a release today as this was not on the radar for any change and has only been detected post-release.
Tested on both iPad 5th gen and iPhone X. Same issue in both yet this was working prior to plugin updates.

If I go into Setting/General/iPad Storage then select my app in the list of apps, the .png file I export IS listed under DOCUMENTS in the app but it is not accessible and does not show up in Files.

Can someone, ANYONE, please enlighten me on changes to saving files on an iOS device AND making that findable/accessible from the Files app

Thanks very much!

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,302 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. LMiles 6 Reputation points

    Very odd behavior on this.

    Un-installed and re-deployed to both test devices multiple times. Was still seeing same issue.

    Changed App Store sign-in on both devices. Used different login credentials on each app on each device. Still same behavior.
    Even deleted and installed app through TestFlight. Same issue.

    Turned off both test devices, restarted. Un-installed and re-deployed exactly same build to both devices.

    ALL WORKING! How ridiculous.

    The good thing is there doesn't SEEM to be anything wrong with prod release.

    0 comments No comments