If you're like 99.9999% of other developers, you're using UserDefaults in an app.

And because you do that, you'll see this message when you upload your next build to the App Store.

Here's what to do about it…

First, read the documentation:

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

The section for UserDefaults is the last one (saving the best for last, of course!)

Describing use of required reason API | Apple Developer Documentation

Ensure your use of covered API is consistent with policy.

Apple Developer Documentation

You'll need to add a new file to your Xcode project. Make sure the PrivacyInfo.xcprivacy file is included in the target (so that it can be extracted after you upload to the App Store).

The documentation here explains how to create the file:

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files#4284009

Privacy manifest files | Apple Developer Documentation

Describe the data your app or third-party SDK collects and the reasons required APIs it uses.

Apple Developer Documentation

The format of the XML in the file isn't obvious. There's a lot of talk about keys for types and description, but the hierarchy wasn't clear to me.

Here's where I landed on the file: https://gist.github.com/chockenberry/2c1c829dba9c7f34c9a7e8e04335be42

NOTE: This file assumes that you only use UserDefaults in the app. If you're using an app group for an extension or whatever, the “CA92.1" won't fly. Read the docs I mentioned earlier!

PrivacyInfo.xcprivacy sample

PrivacyInfo.xcprivacy sample. GitHub Gist: instantly share code, notes, and snippets.

Gist

Also note that this PrivacyInfo.xcprivacy is only for UserDefaults. You may (and probably!) have other APIs you need to declare.

This is a nice little shell script that helps you find the culprits (before the App Store can complain about them):

https://github.com/Wooder/ios_17_required_reason_api_scanner

GitHub - Wooder/ios_17_required_reason_api_scanner: A simple shell script collection to scan your Xcode Swift project for required reason API usage to ensure privacy compliance and to simplify the creation of privacy manifests.

A simple shell script collection to scan your Xcode Swift project for required reason API usage to ensure privacy compliance and to simplify the creation of privacy manifests. - Wooder/ios_17_requi...

GitHub

It sure would have been nice for Apple to document the most widespread use case for privacy.

The motivation here is excellent: it's an effort to reduce the fingerprinting that shithead developers like to do. I'm all for that.

But making me work to figure it all out? And making every other developer who's used UserDefaults do the same thing?

Come on, that's low hanging fruit!

Apple folks: while you're updating these PrivacyInfo.xcprivacy docs, how about putting in some information about how this affects macOS and your other platforms? There's nothing to indicate that it's iOS-only or not at this point.

Also: thanks to @brentsimmons for pointing me in the right direction for a lot of this stuff.

FIN

Just discovered this as a note at the end of one of the documents:

> You only need to supply NSPrivacyAccessedAPITypes for apps and third-party SDKs on iOS, iPadOS, tvOS, visionOS, and watchOS.

We regret the error, but how about putting it front and center?

@chockenberry Yeah, while I was reading what you sent, I thought it's about the SDKs, not apps 🤔

But definitely not clear enough! Especially in combination with app rejection!