Wednesday, May 1, 2024
HomeiOS DevelopmentThe best way to add a privateness manifest file to your app...

The best way to add a privateness manifest file to your app for required motive API utilization? – Donny Wals


Printed on: Might 1, 2024

Apple has not too long ago launched a brand new requirement that makes it in order that apps that use sure APIs for Apple’s cellular platforms (iOS, iPadOS, tvOS, watchOS) should declare their supposed 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 will likely be rejected with a “Lacking API Declaration” message additionally referenced as ITMS-91053.

On this publish, I might like to point out you how one can add a privateness manifest file to your app with the intention to resolve rejections associated to ITMS-91053.

We’ll go over the next subjects:

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

Let’s dive proper in, lets?

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, it is best to check out Apple’s documentation for the reason that listing is just too lengthy for me to repeat right here.

Usually talking although, for those who use an API from one of many following classes you nearly definitely might want to add a declaration to your privateness manifest:

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

Based mostly on this listing, I believe it is extremely doubtless that you’re going to be including a privateness manifest to your app even for those who’re working a small and easy app as a result of a whole lot of apps use UserDefaults to retailer some fundamental consumer info.

For the needs of this publish, I will present you how one can add an acceptable declartion to your privateness manifest for UserDefaults. The steps are just about the identical for each API, they simply have totally different keys that you simply’re supposed to make use of.

How do I add a privateness manifest file to my venture

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

Searching for Privacy in the new file picker

With the privateness manifest file sort 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. It is best to maintain the default identify that Xcode selected for you; PrivacyInfo.

Adding the privacy manifest to your target

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

Step one within the means of determining which keys it is advisable add is to go to Apple’s necessities web page to seek out the reference codes that greatest apply to your utilization of required motive APIs:

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

Within the case of UserDefaults, we’re in all probability eager about considered one of 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 rigorously to make sure you’re not lacking any small particulars or nuances within the descriptions; they are often prety exhausting to learn generally.

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

First, I will 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 needs to be an array.

Subsequent, add a brand new merchandise to your Privateness Accessed API Sorts array. The kind of this new merchandise needs to be a dictionary and within the case of accessing UserDefaults, you will want so as to add a key of Privateness Accessed API Sort 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 on your entry motive. In our case that is CA92.1.

It is fairly robust to accurately describe this plist so let’s simply go forward and have a look at an instance:

A screenshot of the privacy manifest file

Word that I solely pasted CA92.1 into my privateness manifest as my worth for the entry motive and Xcode expanded that into the textual content you see within the screenshot. I personally discover it simpler to have a look at the uncooked XML for this file so for those who proper click on it and choose open as you may view the XML supply code:

Example of opening a privacy manifest as source code

This is what the supply code for my privateness manifest seems 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 motive APIs you entry. In case you overlook 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 for those who’re lacking something.

What about third social gathering SDKs and app extensions?

Each binary in your app should declare its personal privateness manifest. So you probably have app extensions they need to declare required API utilization seperately; you may’t put all declarations in a single file in your app goal.

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

Third social gathering SDKs should additionally embody a privateness manifest explicitly so for those who work on an SDK, now’s the time to essentially be sure to have this accomplished.

In Abstract

Including a privateness manifest file is a brand new requirement from Apple that, in my view, might 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 publish will enable you to get your app coated for this new requirement with the intention to keep away from nasty surprises while you submit your app for overview!



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments