I am trying to build an app which uploads and retrieves images from a Firebase Storage bucket.
The issue is when I try to upload a file it says in the file picker in the IOS simulator the following error: Content Unavailable. The folder contents could not be displayed becuase of an unknown error.
Check also the image below.
I have even downloaded the images and made sure they are in the Photos.
What I have also tried is updating the Info.plist with the following:
<key>NSPhotoLibraryUsageDescription</key>
<string>Your reason for accessing the photo library</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your reason for accessing the microphone</string>
<key>NSCameraUsageDescription</key>
<string>Your reason for accessing the camera</string>

MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="fbStorage.MainPage">
<StackLayout>
<Button Text="Pick and Upload" Clicked="OnUploadButtonClicked" />
<Image x:Name="displayImage" />
</StackLayout>
</ContentPage>
MainPage.xaml.cs:
using Firebase.Storage;
namespace fbStorage;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
//File Picker below
async void OnUploadButtonClicked(object sender, EventArgs e)
{
try
{
FileResult result = await FilePicker.PickAsync();
if (result != null)
{
Stream stream = await result.OpenReadAsync();
await UploadFileToFirebaseStorage(stream, result.FileName);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
async void DisplayImageFromFirebase(string filename)
{
try
{
Stream stream = await GetFileFromFirebaseStorage(filename);
displayImage.Source = ImageSource.FromStream(() => stream);
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
}
async Task UploadFileToFirebaseStorage(Stream stream, string filename)
{
var storage = new FirebaseStorage("link");
var imageRef = storage.Child("images").Child(filename);
var task = imageRef.PutAsync(stream);
task.Progress.ProgressChanged += (s, e) =>
{
};
await task;
DisplayImageFromFirebase(filename);
}
async Task<Stream> GetFileFromFirebaseStorage(string filename)
{
var storage = new FirebaseStorage("link");
var imageRef = storage.Child("images").Child(filename);
var downloadUrl = await imageRef.GetDownloadUrlAsync();
using (var httpClient = new HttpClient())
{
var stream = await httpClient.GetStreamAsync(downloadUrl);
return stream;
}
}
}