Tuesday, June 25, 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 purpose API utilization?

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 cell 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 probably be rejected with a “Lacking API Declaration” message additionally referenced as ITMS-91053.

On this put up, I might like to point out you how one can add a privateness manifest file to your app so as 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 celebration SDKs and app extensions?

Let’s dive proper in, lets?

The best manner so that you can construct your privateness manifest is thru my Privateness Manifest Generator. Use it alongside this text to effortlessly get your manifest so as.

If you happen to favor to be taught from movies, watch the video under:

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 because the listing is just too lengthy for me to repeat right here.

Typically 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 area APIs
  • Energetic keyboard APIs
  • Consumer Defaults APIs

Primarily based on this listing, I believe it is extremely probably that you will be including a privateness manifest to your app even if you happen to’re working a small and easy app as a result of a number of apps use UserDefaults to retailer some primary consumer info.

For the needs of this put up, 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 totally different keys that you simply’re supposed to make use of.

How do I add a privateness manifest file to my venture

You may add your privateness manifest identical to you add another 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 would not choose your goal by default so do not skip doing this your self. It’s best to preserve 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 right contents to it.

Step one within the means of determining which keys you want 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 purpose APIs:

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

Within the case of UserDefaults, we’re most likely fascinated by certainly 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 to 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 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 may 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 to your entry purpose. 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 file

Be aware that I solely pasted CA92.1 into my privateness manifest as my worth for the entry purpose 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 possibly can 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">

Repeat the steps above for another required purpose APIs you entry. If you happen to neglect any, Apple will electronic mail you with info on which keys you forgot in your rejection electronic mail which is able to 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 in case you have app extensions they have to declare required API utilization seperately; you possibly can’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 embody 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 carried out.

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 put up will show you how to get your app lined for this new requirement so as to keep away from nasty surprises while you submit your app for evaluate!



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments