I’m creating a new project called LanguageInUse with NET8 and MAUI and I like to save the user credentials using the SecureStorage
. Like in other cases, there are a few things that you can find but you must be done in order to have a working project.
Let me show you how to configure your MAUI project properly. No settings are required for Windows.
Apple
So, looking at the documentation, I couldn’t find any explanation for why my application was crashing when it tried to save or delete something from the SecureStorage
. The reason is that for iOS, I have to declare that I want to use secure storage.
Add an Entitlements.plist file
For this reason, I have to instruct the iOS to allow the application to use the SecureStorage
. I have to add a new file.
To add a new entitlements file to your .NET MAUI app project, add a new XML file named Entitlements.plist to the Platforms\iOS folder of your app project. Then add the following XML to the file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
Entitlements can be configured in Visual Studio by double-clicking the Entitlements.plist file to open it in the entitlements editor.
- In Solution Explorer, double-click the Entitlements.plist file from the Platforms > iOS folder of your .NET MAUI app project to open it in the entitlements editor.
- In the entitlements editor, select and configure any entitlements required by your app

Save the changes to your Entitlements.plist file to add the entitlement key/value pairs to the file.
Consume entitlements
A .NET MAUI iOS app must be configured to consume the entitlements defined in the Entitlements.plist file.
- In Solution Explorer, right-click on your .NET MAUI app project and select Properties. Then, navigate to the iOS > Bundle Signing tab.
- In the Bundle Signing settings, click the Browse… button for the Custom Entitlements field.
- In the Custom Entitlements dialog, navigate to the folder containing your Entitlements.plist file, select the file, and click the Open button.
- In the project properties, the Custom Entitlements field will be populated with your entitlements file:

Android
The steps I have taken to resolve this error are:
- Creating a
proguard.cfg
file in “Project/Platforms/Android/” in your file system. - In your .csproj file, set it as a
ProguardConfiguration
:
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
<ProguardConfiguration Include="Platforms\Android\proguard.cfg" />
</ItemGroup>

- In your
proguard.cfg
file, add the following lines (you may be able to use less broad rules like in your original post but I have not tested this):
-keep class androidx.security.crypto.** { *; }
-keep class com.google.crypto.tink.** { *; }
- Configure selective backup for MAUI essentials: https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/storage/secure-storage?view=net-maui-8.0&tabs=android#selective-backup
- You will also want to setup data extraction rules for use on Android 12+. App center has a good example of how those should look: https://learn.microsoft.com/en-us/appcenter/sdk/getting-started/xamarin#52-for-android-12-api-level-31-or-higher