include NSPrivacyAccessedAPICategoryDiskSpace & NSPrivacyAccessedAPICategoryFileTimestamp Information🤔
Aishanii

Aishanii @aishanipach

About: I journal tech learnings and may give my 2 cents💁‍♀️ | Follow my System design journey!

Location:
India
Joined:
Mar 14, 2021

include NSPrivacyAccessedAPICategoryDiskSpace & NSPrivacyAccessedAPICategoryFileTimestamp Information🤔

Publish Date: Apr 1 '24
2 2

Hey, so apple just came out of nowhere and sent a big email outlining something like NSPrivacyAccessedAPICategoryFileTimestamp Information, NSPrivacyAccessedAPICategoryDiskSpace and NSFileSystemFreeSize with few other API declaration.

Here's what it means for you as a developer and here is what you can do.

How to release my current app😵‍💫

Don't worry till May 1st, Apple doesn't expect you to declare these. In fact, they would just flag the required API declaration and approve your app for now. So pushing to production won't stop🥳

How do I get what are the declarations required before submission on Appstore?

You can run a bash script to check your codebase and dependencies for such API declaration requirements.

Use the following one:
https://github.com/Wooder/ios_17_required_reason_api_scanner/blob/main/required_reason_api_text_scanner.sh

  • Download the required_reason_api_scanner_text.sh file.

  • Go to terminal and go to the directory where this file was downloaded to. Run the following command with your app directory path.

sh required_reason_api_scanner.sh <AppDirectory>
Enter fullscreen mode Exit fullscreen mode

This will give you a list of declarations, in the following format:

Found potentially required reason API usage 'UserDefaults'
in './ViewController.swift' Line numbers: 128

  • Search for the API declarations mentioned here:

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

What's next?

  1. Go to Xcode (15 and above)
  2. File -> New -> File
  3. Search and select the 'App privacy' option
  4. The default privacy file name is required, do not change that and continue
  5. Copy the following file, and edit the newly created 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>NSPrivacyAccessedAPICategoryUserDefaults</string>
   <key>NSPrivacyAccessedAPITypeReasons</key>
   <array>
    <string>CA92.1</string>
   </array>
  </dict>
 </array>
</dict>
</plist>
Enter fullscreen mode Exit fullscreen mode

You're done!
Build your app, sit back and relax.⛱️

Comments 2 total

  • Anjan13
    Anjan13Apr 6, 2024

    @aishanipach Thanks for such cool information. its really helpful.
    I have small query that my project is running on react native and i have upgraded some third party software as well as added some privacy policy but when i again try to run sam script it still shows same third party required to update. May i know how i can generate clean report for it

Add comment