/app_store_required_privacy_manifest_analyser

A shell script used to analyze privacy manifests in the specified directory to ensure that your app complies with the App Store requirements.

Primary LanguageShellMIT LicenseMIT

App Store Privacy Manifest Analyzer

Analysis Support License

A shell script used to analyze privacy manifests in the specified directory to ensure that your app complies with the App Store requirements.

If upgrading the SDK does not resolve privacy manifest issues or you wish to keep the project as is without migration, it is recommended to use the app_privacy_manifest_fixer based on the current analysis script to fix privacy manifest issues.

Features

  • Support analysis of API usage within any directory.
  • Scan all source files (including .h, .m, .mm, .c, .cc, .hpp, .cpp, and .swift files) as well as binary files.
  • Automatically detect missing privacy manifest files and API declarations.
  • Support for tagging commonly used SDKs.
  • Provide API usage that could affect your app's privacy manifest.

Requirements

  • macOS: Xcode Command Line Tools installed.

You can try executing the following command to determine if your Mac device supports the script:

xcrun swift -version

If the output after execution resembles the example below:

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)

Congratulations! You are now ready to start using the script. Should you encounter any other issues, you can attempt to install Xcode Command Line Tools using the following command:

xcode-select --install

Usage

1. Getting Started

sh analyser.sh <directory_path>

Example output:

============================ Analyzing Runner Project ============================

💡 Found privacy manifest file(s): 1
[0] ./Runner/PrivacyInfo.xcprivacy
API usage analysis result(s): 0
✅ All required API reasons have been described in the privacy manifest.

======================== Analyzing CocoaPods Dependencies ========================

Analyzing FBSDKCoreKit 🎯 ...
💡 Found privacy manifest file(s): 3
[0] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-simulator/FBSDKCoreKit.framework/PrivacyInfo.xcprivacy
[1] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-maccatalyst/FBSDKCoreKit.framework/Versions/A/Resources/PrivacyInfo.xcprivacy
[2] ./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/PrivacyInfo.xcprivacy
API usage analysis result(s): 3
[0] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/FBSDKCoreKit
[1] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-maccatalyst/FBSDKCoreKit.framework/FBSDKCoreKit
[2] NSPrivacyAccessedAPICategoryUserDefaults:NSUserDefaults:./Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_x86_64-simulator/FBSDKCoreKit.framework/FBSDKCoreKit
✅ All required API reasons have been described in the privacy manifest.

Analyzing DKImagePickerController 🎯 ...
⚠️  Missing privacy manifest file!
API usage analysis result(s): 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp:.modificationDate:./Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageAssetExporter.swift
🛠️  Descriptions for the following required API reason(s) may be missing: 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp

Analyzing SDWebImage 🎯 ...
💡 Found privacy manifest file(s): 1
[0] ./Pods/SDWebImage/WebImage/PrivacyInfo.xcprivacy
API usage analysis result(s): 1
[0] NSPrivacyAccessedAPICategoryFileTimestamp:NSURLContentModificationDateKey,NSURLCreationDateKey:./Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m
✅ All required API reasons have been described in the privacy manifest.

Analyzing Mantle ...
⚠️  Missing privacy manifest file!
API usage analysis result(s): 0

...

========================= Analyzing Flutter Dependencies =========================

Analyzing device_info_plus-9.1.0 🎯 ...
⚠️  Missing privacy manifest file!
API usage analysis result(s): 0

Analyzing shared_preferences_ios-2.1.1 🎯 ...
⚠️  Missing privacy manifest file!
API usage analysis result(s): 3
[0] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults,NSUserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/FLTSharedPreferencesPlugin.m
[1] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.h
[2] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.m
🛠️  Descriptions for the following required API reason(s) may be missing: 1
[0] NSPrivacyAccessedAPICategoryUserDefaults

...

========== Analysis completed! ⏰: 229s 💡: 6 ⚠️ : 30 🛠️ : 10 ✅: 6 🎯: 10 ===========

⚠️ 🛠️  https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api
🎯 https://developer.apple.com/support/third-party-SDK-requirements

🔔 If the directory you are analyzing is the app project directory, your app's privacy manifest may be affected by these analysis results: 20
[0] NSPrivacyAccessedAPICategoryFileTimestamp:.modificationDate:./Pods/DKImagePickerController/Sources/DKImagePickerController/DKImageAssetExporter.swift
[1] NSPrivacyAccessedAPICategoryFileTimestamp:NSURLContentModificationDateKey,NSURLCreationDateKey:./Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m
[2] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults,NSUserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/FLTSharedPreferencesPlugin.m
[3] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.h
[4] NSPrivacyAccessedAPICategoryUserDefaults:UserDefaults:./.symlinks/plugins/shared_preferences_ios/ios/Classes/messages.g.m
...

⚠️ 🛠️: When the privacy manifest of third-party SDKs is missing, please update the third-party SDKs or provide feedback to the developers.

If your app's code has the same issue, please refer to the following documents or video for resolution:

🎯: Please promptly update these commonly used SDKs highlighted by the App Store. The complete list is from Upcoming third-party SDK requirements.

🔔: For non-dynamically linked libraries, they are fully copied into the executable file of the application bundle during compilation, which may result in unknown API usage when scanning the executable file of the application.

To pass the App Store review, you need to declare the APIs used by these non-dynamically linked libraries in your app's privacy manifest. You might feel confused as you are not sure where exactly these APIs are being used.

To address this confusion, the analyzer will list API usage that may affect your app's privacy manifest. Pay attention to it, as it will help you fill out the app's privacy manifest more accurately.

2. Command Line Options

  • -c: Not to filter comments when scanning source code.
sh analyser.sh -c <directory_path>

It is not recommended to enable this option for the accuracy of API scanning.

  • -d: Specify the directory where local dependencies are located (e.g., Vendor, ThirdParty, etc.).
sh analyser.sh -d <dependencies_directory_path> <directory_path>

Local dependencies will be analyzed separately, just like dependencies from CocoaPods, SwiftPM, Carthage, and so on.

  • -e: Specify directory to exclude from analysis.
sh analyser.sh -e <excluded_directory_path> <directory_path>
  • -i: Ignore dependencies during analysis.
sh analyser.sh -i <directory_path>

This option is typically used for the analysis of Swift Package Manager projects. Please refer to: ios_swiftpm_example.

  • -v: Display verbose information.
sh analyser.sh -v <directory_path>

3. Saving Analysis Log

sh analyser.sh <directory_path> > log.txt

Supported Dependency Sources for Separate Analysis

Dependency Source Example
CocoaPods ios_example
Swift Package Manager ios_swiftpm_example
Carthage ios_carthage_example
Flutter flutter_example
Application Bundle Planned

Privacy Access Report

Use the tool to quickly generate a privacy access report for your app.

Report Example

Report Example

Commonly Used SDKs

SDK Name Minimum Supported Version of Privacy Manifest
Abseil 1.20240116.1
AFNetworking Deprecated
Alamofire 5.9.0
AppAuth 1.7.0
BoringSSL / openssl_grpc 0.0.32
Capacitor 5.7.3
Charts 5.1.0
connectivity_plus 6.0.1
Cordova 7.1.0
device_info_plus 10.0.1
DKImagePickerController 4.3.6
DKPhotoGallery 0.0.18
FBAEMKit 17.0.0
FBLPromises 2.4.0
FBSDKCoreKit 17.0.0
FBSDKCoreKit_Basics 17.0.0
FBSDKLoginKit 17.0.1
FBSDKShareKit 17.0.1
file_picker 8.0.0
FirebaseABTesting 10.22.0
FirebaseAuth 10.22.0
FirebaseCore 10.22.0
FirebaseCoreDiagnostics Deprecated
FirebaseCoreExtension 10.22.0
FirebaseCoreInternal 10.22.0
FirebaseCrashlytics 10.22.0
FirebaseDynamicLinks 10.22.0
FirebaseFirestore 10.22.0
FirebaseInstallations 10.22.0
FirebaseMessaging 10.22.0
FirebaseRemoteConfig 10.22.0
Flutter 3.19.0
flutter_inappwebview 6.1.0
flutter_local_notifications 16.3.1+1
fluttertoast 8.2.5
FMDB 2.7.9
geolocator_apple 2.3.7
GoogleDataTransport 9.4.0
GoogleSignIn 7.1.0
GoogleToolboxForMac 4.2.0
GoogleUtilities 7.13.0
grpcpp 1.64.0
GTMAppAuth 4.1.0
GTMSessionFetcher 3.3.0
hermes Deprecated
image_picker_ios 0.8.9+1
IQKeyboardManager 6.5.13
IQKeyboardManagerSwift 6.5.13
Kingfisher 7.9.0
leveldb 1.22.4
Lottie 4.4.0
MBProgressHUD Unreleased
nanopb 0.4.9
OneSignal 3.12.9
OneSignalCore 3.12.9
OneSignalExtension 3.12.9
OneSignalOutcomes 3.12.9
OpenSSL 3.4.0
OrderedSet 6.0.2
package_info Deprecated
package_info_plus 6.0.0
path_provider 2.1.3
path_provider_ios Deprecated
Promises 2.4.0
Protobuf 3.27.0
Reachability 5.2.0
RealmSwift 10.48.1
RxCocoa 6.8.0
RxRelay 6.8.0
RxSwift 6.8.0
SDWebImage 5.18.7
share_plus 8.0.2
shared_preferences_ios Deprecated
SnapKit 5.7.0
sqflite 2.3.1
Starscream 4.0.7
SVProgressHUD 2.3.0
SwiftyGif 5.4.5
SwiftyJSON 5.0.2
Toast 4.1.0
UnityFramework Unity 6
url_launcher 6.2.6
url_launcher_ios 6.2.4
video_player_avfoundation 2.5.6
wakelock Deprecated
webview_flutter_wkwebview 3.10.2

Most deprecated SDKs have been replaced by better alternatives. If you prefer not to migrate, consider using the app_privacy_manifest_fixer to resolve privacy manifest issues.

For the AFNetworking SDK, which is no longer actively maintained, you can resolve privacy manifest issues also by updating the source reference in your Podfile as shown below:

pod 'AFNetworking', :git => 'https://github.com/crasowas/AFNetworking.git'

Acknowledgements