DeclaredAgeRange 1.0.0

dotnet add package DeclaredAgeRange --version 1.0.0
                    
NuGet\Install-Package DeclaredAgeRange -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DeclaredAgeRange" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DeclaredAgeRange" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DeclaredAgeRange" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DeclaredAgeRange --version 1.0.0
                    
#r "nuget: DeclaredAgeRange, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DeclaredAgeRange@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DeclaredAgeRange&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DeclaredAgeRange&version=1.0.0
                    
Install as a Cake Tool

DeclaredAgeRange

.NET binding for Apple's Declared Age Range API on iOS 26+ and macOS 26+. Request the signed-in user's age range with one await and deliver an age-appropriate experience without learning their exact age.

using DeclaredAgeRange;

if (AgeRangeService.IsSupported)                       // OS 26+ on real hardware
{
    try
    {
        var response = await AgeRangeService.RequestAgeRangeAsync(ageGate: 16);

        if (response is AgeRangeResponse.Sharing { AgeRange: var range } && range.IsAtLeast(16))
            ShowFullExperience();
        else
            ShowRestrictedExperience();               // declined, or under 16
    }
    catch (AgeRangeException ex)
    {
        // ex.Error: NotAvailable, InvalidRequest, InvalidAccount, DeclinedOnboarding, Network, Unknown
    }
}

Setup

  1. Add com.apple.developer.declared-age-range (true) to your app's Entitlements.plist.
  2. Enable the Declared Age Range capability on the app's identifier in the Apple Developer portal and regenerate the provisioning profile.

The API only works on a physical device. On the Simulator IsSupported is false and requests fail with AgeRangeError.NotAvailable.

Full documentation, source and sample: https://github.com/TheLostPantheon/DeclaredAgeRange

Product Compatible and additional computed target framework versions.
.NET net9.0-ios18.0 is compatible.  net9.0-macos15.0 is compatible.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-macos was computed.  net10.0-macos26.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-ios26.0

    • No dependencies.
  • net10.0-macos26.0

    • No dependencies.
  • net9.0-ios18.0

    • No dependencies.
  • net9.0-macos15.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 104 9/17/2026