Tips on how to add a privateness manifest file to your app for required cause API utilization?


Printed on: Might 1, 2024

Apple has just lately launched a brand new requirement that makes it in order that apps that use sure APIs for Apple’s cell platforms (iOS, iPadOS, tvOS, watchOS) should declare their meant use of sure APIs. This requirement has gone in impact on Might 1st which implies that any app updates or submissions that do not meet Apple’s new necessities can be rejected with a “Lacking API Declaration” message additionally referenced as ITMS-91053.

On this submit, I would like to indicate you how one can add a privateness manifest file to your app to be able to resolve rejections associated to ITMS-91053.

We’ll go over the next matters:

  • Which APIs require a declaration in a privateness manifest?
  • How do I add a privateness manifest to my undertaking?
  • What about third celebration SDKs and app extensions?

Let’s dive proper in, we could?

Which APIs require a declaration in a privateness manifest?

Beginning Might 1st 2024, there’s a big listing of APIs that require a declaration in your privateness manifest file. For a full overview, you need to check out Apple’s documentation for the reason that listing is just too lengthy for me to repeat right here.

Usually talking although, if you happen to use an API from one of many following classes you virtually definitely might want to add a declaration to your privateness manifest:

  • File timestamp APIs
  • System boot time APIs
  • Disk house APIs
  • Lively keyboard APIs
  • Consumer Defaults APIs

Based mostly on this listing, I believe it is extremely probably that you’re going to be including a privateness manifest to your app even if you happen to’re operating a small and easy app as a result of plenty of apps use UserDefaults to retailer some fundamental consumer info.

For the needs of this submit, I am going to present you how one can add an applicable declaration to your privateness manifest for UserDefaults. The steps are just about the identical for each API, they only have completely different keys that you simply’re supposed to make use of.

How do I add a privateness manifest file to my undertaking

You’ll be able to add your privateness manifest identical to you add some other file to your undertaking. In Xcode, choose file->new->file and search for the privateness manifest file kind:

Searching for Privacy in the new file pickerSearching for Privacy in the new file picker

With the privateness manifest file kind chosen, click on subsequent so as to add your privateness manifest to your app goal. It does not choose your goal by default so do not skip doing this your self. You need to hold the default identify that Xcode selected for you; PrivacyInfo.

Adding the privacy manifest to your targetAdding the privacy manifest to your target

Now that you’ve your privateness manifest added to your app, it is time to add the right contents to it.

Step one within the strategy of determining which keys you have to add is to go to Apple’s necessities web page to search out the reference codes that finest apply to your utilization of required cause APIs:

A screenshot of Apple's documentation for UserDefaults required reasons.A screenshot of Apple's documentation for UserDefaults required reasons.

Within the case of UserDefaults, we’re most likely fascinated with one among two keys: CA92.1 or 1C8F.1 relying on whether or not you are constructing an app that makes use of an App Group. Be sure you learn each description fastidiously to make sure you’re not lacking any small particulars or nuances within the descriptions; they are often prety arduous to learn typically.

My app is not a part of an App Group so I am going to must declare CA92.1 in my privateness manifest file.

First, I am going to want so as to add the Privateness Accessed API Sorts key to my privateness manifest file. Do that by clicking the little + icon subsequent to the App Privateness Configuration key that is already within the privateness manifest. The kind of Privateness Accessed API Sorts ought to be an array.

Subsequent, add a brand new merchandise to your Privateness Accessed API Sorts array. The kind of this new merchandise ought to be a dictionary and within the case of accessing UserDefaults, you will want so as to add a key of Privateness Accessed API Kind with the worthNSPrivacyAccessedAPICategoryUserDefaults to this dictionary first. The second key you add to your dictionary is Privateness Accessed API Causes which is an array. To that array, you add the code in your entry cause. In our case that is CA92.1.

It is fairly powerful to appropriately describe this plist so let’s simply go forward and take a look at an instance:

A screenshot of the privacy manifest fileA screenshot of the privacy manifest file

Be aware that I solely pasted CA92.1 into my privateness manifest as my worth for the entry cause and Xcode expanded that into the textual content you see within the screenshot. I personally discover it simpler to take a look at the uncooked XML for this file so if you happen to proper click on it and choose open as you’ll be able to view the XML supply code:

Example of opening a privacy manifest as source codeExample of opening a privacy manifest as source code

This is what the supply code for my privateness manifest seems to be like:

<?xml model="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist model="1.0">
<dict>
    <key>NSPrivacyAccessedAPITypes</key>
    <array>
        <dict>
            <key>NSPrivacyAccessedAPIType</key>
            <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
            <key>NSPrivacyAccessedAPITypeReasons</key>
            <array>
                <string>CA92.1</string>
            </array>
        </dict>
    </array>
</dict>
</plist>

Repeat the steps above for some other required cause APIs you entry. If you happen to neglect any, Apple will e mail you with info on which keys you forgot in your rejection e mail which can assist you determine what so as to add if you happen to’re lacking something.

What about third celebration SDKs and app extensions?

Each binary in your app should declare its personal privateness manifest. So when you’ve got app extensions they have to declare required API utilization seperately; you’ll be able to’t put all declarations in a single file in your app goal.

Your app extensions can use the identical information, however they nonetheless must have the file added to their targets explicitly to have them appropriately be discoverd.

Third celebration SDKs should additionally embrace a privateness manifest explicitly so if you happen to work on an SDK, now could be the time to essentially be sure to have this executed.

In Abstract

Including a privateness manifest file is a brand new requirement from Apple that, in my view, may have been dealt with higher. Manually engaged on plist information is a tedious job and the keys and values aren’t that straightforward to handle.

Hopefully this submit will allow you to get your app lined for this new requirement to be able to keep away from nasty surprises whenever you submit your app for overview!

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox