diff --git a/src/Templates/src/templates/maui-blazor/Platforms/iOS/Resources/PrivacyInfo.xcprivacy b/src/Templates/src/templates/maui-blazor/Platforms/iOS/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000000..24ab3b4334cb --- /dev/null +++ b/src/Templates/src/templates/maui-blazor/Platforms/iOS/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,51 @@ + + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + + diff --git a/src/Templates/src/templates/maui-mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy b/src/Templates/src/templates/maui-mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000000..24ab3b4334cb --- /dev/null +++ b/src/Templates/src/templates/maui-mobile/Platforms/iOS/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,51 @@ + + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + + diff --git a/src/Templates/src/templates/maui-multiproject/MauiApp.1.iOS/Resources/PrivacyInfo.xcprivacy b/src/Templates/src/templates/maui-multiproject/MauiApp.1.iOS/Resources/PrivacyInfo.xcprivacy new file mode 100644 index 000000000000..24ab3b4334cb --- /dev/null +++ b/src/Templates/src/templates/maui-multiproject/MauiApp.1.iOS/Resources/PrivacyInfo.xcprivacy @@ -0,0 +1,51 @@ + + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + + + diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs index 287fd78e3814..8c85dacda959 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs @@ -442,6 +442,47 @@ public void CheckEntitlementsForMauiBlazorOnMacCatalyst(string id, string config CollectionAssert.AreEqual(expectedEntitlements, foundEntitlements, "Entitlements missing from executable."); } + [Test] + [TestCase("maui-blazor", "Debug", DotNetCurrent)] + [TestCase("maui-blazor", "Release", DotNetCurrent)] + [TestCase("maui", "Debug", DotNetCurrent)] + [TestCase("maui", "Release", DotNetCurrent)] + [TestCase("maui-multiproject", "Debug", DotNetCurrent)] + [TestCase("maui-multiproject", "Release", DotNetCurrent)] + public void CheckPrivacyManifestForiOS(string id, string config, string framework) + { + if (TestEnvironment.IsWindows) + { + Assert.Ignore("Running iOS templates is only supported on Mac."); + } + + string projectDir = TestDirectory; + string projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj"); + string appFileName = $"{Path.GetFileName(projectDir)}.app"; + string appLocation = + Path.Combine(projectDir, "bin", config, $"{framework}-ios", "iossimulator-x64", appFileName); + + // Multi-project is in a .iOS subfolder and csproj is *.iOS.csproj + if (id.EndsWith("multiproject")) + { + projectFile = + Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.iOS", $"{Path.GetFileName(projectDir)}.iOS.csproj"); + + appFileName = $"{Path.GetFileName(projectDir)}.iOS.app"; + + appLocation = + Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.iOS", "bin", config, $"{framework}-ios", "iossimulator-x64", appFileName); + } + + Assert.IsTrue(DotnetInternal.New(id, projectDir, framework), $"Unable to create template {id}. Check test output for errors."); + Assert.IsTrue(DotnetInternal.Build(projectFile, config, framework: $"{framework}-ios", msbuildWarningsAsErrors: true), + $"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors."); + + string manifestLocation = Path.Combine(appLocation, "PrivacyInfo.xcprivacy"); + + Assert.IsTrue(File.Exists(manifestLocation), $"Privacy Manifest not found in {manifestLocation}."); + } + [Test] public void BuildHandlesBadFilesInImages() {