Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Check Apple Privacy Manifest requirements

Open jfversluis opened this issue 1 year ago • 6 comments
trafficstars

Apple is introducing a privacy policy for including privacy manifest files in new and updated applications targeted for iOS, iPadOS, tvOS, and visionOS platforms on the App Store.

We should check if we're using one of the APIs that needs an entry in a Privacy Manifest and provide our users with guidance and/or include a manifest in our own library.

We probably also need to check this for the Xamarin Community Toolkit.

jfversluis avatar Mar 08 '24 10:03 jfversluis

Can the priority of this be increased?

maonaoda avatar Mar 11 '24 05:03 maonaoda

Its worth noting that from the 1st May 2024 this will be a requirement. This is what I received when submitting an app for review.

"While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code."

If adding native support will take too long then at very least have some documentation on how you add such a file to your maui project.

owaits avatar Mar 14 '24 10:03 owaits

We're very aware and work is being done, no worries. This also transcends just the Toolkit. You can see instructions we're working on here: https://github.com/xamarin/xamarin-macios/pull/20292

jfversluis avatar Mar 14 '24 10:03 jfversluis

@owaits if I may, we would love to double-check if this works for your scenario. Could I maybe ask you...

  • A list of the dependencies you are using in your project
  • To try and follow the instructions in the linked PR above and let us know if that is clear
  • Let us know what the contents of your privacy manifest look like
  • And if that stops triggering this message (in other words: you are now compliant)

jfversluis avatar Mar 14 '24 11:03 jfversluis

A list of the dependencies you are using in your project

I have attached the linker output from the Android build, does this give you the dependancy information you need? We have quite complicated project structure with lots of interlinked dependencies. They also all build for at least 4 different frameworks each so difficult to extract what's related to MAUI. Most of the projects date back to pre-xamarin days.

35.txt

To try and follow the instructions in the linked PR above and let us know if that is clear

I found it confusing that it starts by telling you what to put in the file and then tells you how the create the PrivacyInfo.xcprivacy file. I think I would have found it easier if it had started with "in your maui project right click in Platforms\iOS folder and add new ??" I had to add a cs file then open the plist file and copy across contents. Maybe state to paste in a template here from the docs? Then you need to edit the csproj to add the special bundle code which I initially missed.

Let us know what the contents of your privacy manifest look like

These are the changes I made after reading the docs.

csproj

<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
    <CodesignKey>***</CodesignKey>
    <CodesignProvision>***</CodesignProvision>
    <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
</PropertyGroup>

PrivacyInfo.xcprivacy

<?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>
    <key>NSPrivacyAccessedAPITypes</key>
    <array>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>C617.1</string>
            </array>
        </dict>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategorySystemBootTime</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>35F9.1</string>
            </array>
        </dict>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategoryDiskSpace</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>E174.1</string>
            </array>
        </dict>
	</array>
</dict>
</plist>

And if that stops triggering this message (in other words: you are now compliant)

I will have to let you know on this one.

owaits avatar Mar 14 '24 12:03 owaits

@owaits please let us know as soon as you get a response from Apple! Or in this case we would rather not get a response... 😉

Seems like the logs contains the Android build output, but we're specifically interested in iOS here. I think just the overview from your csproj file with the libraries you're using in your project should be enough. Thanks again!

jfversluis avatar Mar 14 '24 13:03 jfversluis

error MSB4066: The attribute "Include" in element <BundleResource> is unrecognized.

I am getting this error when adding it in like @owaits

ISSPRO-Eng avatar Mar 15 '24 19:03 ISSPRO-Eng

@ISSPRO-Eng could you please provide more details? What are you adding exactly and where?

jfversluis avatar Mar 15 '24 19:03 jfversluis

Adding` in the privacy manifest. I have the actual .xcprivacy file located at "My Project Name"/Platforms/iOS/PrivacyInfo.xcprivacy

I have added it in my csproj file here <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'"> <RuntimeIdentifier>ios-arm64</RuntimeIdentifier> <CreatePackage>false</CreatePackage> <CodesignProvision>XXX</CodesignProvision> <CodesignKey>XXX</CodesignKey> <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements> <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" /> <DeviceSpecificBuild>true</DeviceSpecificBuild> </PropertyGroup>

ISSPRO-Eng avatar Mar 15 '24 19:03 ISSPRO-Eng

Changed it to <BundleResource> Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" </BundleResource> and everything works now

ISSPRO-Eng avatar Mar 15 '24 19:03 ISSPRO-Eng

Interesting that that makes a difference. Please let us know if that also makes the warning from Apple disappear, thanks!

jfversluis avatar Mar 15 '24 19:03 jfversluis

Seems that it made the warning go away for uploading to the App Store. I was instantly getting messages after uploading about compliance, but have not gotten one yet

ISSPRO-Eng avatar Mar 15 '24 19:03 ISSPRO-Eng

Anddd I got the compliance message again. Still not resolved

ISSPRO-Eng avatar Mar 15 '24 21:03 ISSPRO-Eng

@ISSPRO-Eng could you maybe provide a list of the third-party libraries you're using?

jfversluis avatar Mar 16 '24 08:03 jfversluis

ITMS-91053: Missing API declaration - Your app’s code in the “MultiGaugeAttributeProgrammer” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryFileTimestamp. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

ITMS-91053: Missing API declaration - Your app’s code in the “MultiGaugeAttributeProgrammer” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategorySystemBootTime. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

ITMS-91053: Missing API declaration - Your app’s code in the “MultiGaugeAttributeProgrammer” file references one or more APIs that require reasons, including the following API categories: NSPrivacyAccessedAPICategoryDiskSpace. While no action is required at this time, starting May 1, 2024, when you upload a new app or app update, you must include a NSPrivacyAccessedAPITypes array in your app’s privacy manifest to provide approved reasons for these APIs used by your app’s code. For more details about this policy, including a list of required reason APIs and approved reasons for usage, visit: https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api.

Apple Developer Relations

This was from Apple.

Current Packages are Community Toolkit, FFImageLoading.Maui, Laerdal.Dfu, Mopups, Maui.ColorPicker, Plugin.BLE, Shiny.BluetoothLE, SkiaSharp, SkiaSharp.svg, SkiaSharp.Views.Maui

ISSPRO-Eng avatar Mar 18 '24 13:03 ISSPRO-Eng

Thanks for the information!

Would you be able to help me out a little further?

  1. Could you confirm what the current contents are in your PrivacyManifest.xcprivacy file?
  2. Is the entry for this in your csproj still what you mentioned above? Would you be able to maybe provide the full contents of your csproj file (maybe partially redact sensitive values, but try to keep it all original as much as possible)
  3. For the ipa that you are sending for review, could you make a copy, rename it from YourApp.ipa to YourApp.zip and look inside of it and verify that the PrivacyManifest.xcprivacy is in there? And what the exact location for it is?

Trying to help you (and everyone else) get past this!

Thank you!

jfversluis avatar Mar 18 '24 14:03 jfversluis

Privacy Help.zip

I have attached a zip here with a mostly original .csproj and the Privacy Manifest.

I actually did not see the Privacy Manifest being bundled into the ipa file when looking at it. Wondering why that may be...

ISSPRO-Eng avatar Mar 18 '24 15:03 ISSPRO-Eng

I added this to the bottom of my .csproj and removed it from the iOS section.

<ItemGroup>
	  <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" />
	</ItemGroup>

The PrivacyInfo document is now located at /Platforms/iOS/PrivacyInfo.xcprivacy. The documentation says the Privacy Manifest needs to be at the root of the bundle though, so it is not in the correct spot.

ISSPRO-Eng avatar Mar 18 '24 15:03 ISSPRO-Eng

@ISSPRO-Eng I don't see any elements in your .csproj file to handle the xcprivacy file. Can you add the following to your project and see if the PrivacyInfo.xcprivacy file is placed correctly in the bundle? And also make sure the PrivacyInfo.xcprivacy is in the Platforms\iOS\ folder,

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
  <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
</ItemGroup>

mcumming avatar Mar 18 '24 15:03 mcumming

Looks like that added it to the root ^^

Will give an update after submitting to the App Store.

ISSPRO-Eng avatar Mar 18 '24 16:03 ISSPRO-Eng

Hi @ISSPRO-Eng any updates?

mcumming avatar Mar 19 '24 13:03 mcumming

It was accepted with no issues !

ISSPRO-Eng avatar Mar 19 '24 13:03 ISSPRO-Eng

I don't think we need anything for our library. Going to verify tomorrow.

Adding discussion label so we can mention it during the standup

jfversluis avatar Mar 26 '24 19:03 jfversluis

No special requirements for this library.

Follow the instructions here for a .NET (MAUI) app and that should be enough to also cover the .NET MAUI Community Toolkit!

jfversluis avatar Mar 29 '24 15:03 jfversluis