Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Priavacy Policy aggregation errors on empty dict #44401

Closed
johnf opened this issue May 3, 2024 · 9 comments · May be fixed by #44402
Closed

Priavacy Policy aggregation errors on empty dict #44401

johnf opened this issue May 3, 2024 · 9 comments · May be fixed by #44402

Comments

@johnf
Copy link

johnf commented May 3, 2024

Description

pod update will failed when it tries to aggregate a privacy policy with an empty dict. For example

<?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>NSPrivacyTracking</key>
        <false/>
        <key>NSPrivacyTrackingDomains</key>
        <array/>
        <key>NSPrivacyCollectedDataTypes</key>
        <array/>
        <key>NSPrivacyAccessedAPITypes</key>
        <array>
                <dict/>
        </array>
</dict>
</plist>

I came across this in https://github.com/TimOliver/TOCropViewController which is a dependency of https://github.com/ivpusic/react-native-image-crop-picker

Steps to reproduce

  1. yarn add react-native-image-crop-picker
  2. cd ios
  3. pod update

React Native Version

0.74.1

Affected Platforms

Build - MacOS

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: Linux 6.8 Ubuntu 23.10 23.10 (Mantic Minotaur)
  CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
  Memory: 9.27 GB / 30.50 GB
  Shell:
    version: 5.2.15
    path: /bin/bash
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/work/gladly/mobile/node_modules/.bin/yarn
  npm:
    version: 10.7.0
    path: ~/work/gladly/mobile/node_modules/.bin/npm
  Watchman:
    version: 4.9.0
    path: /usr/bin/watchman
SDKs:
  Android SDK:
    API Levels:
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 31.0.0
      - 32.1.0
      - 33.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-31 | Intel x86_64 Atom
      - android-31 | Google APIs Intel x86_64 Atom
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play Intel x86 Atom_64
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: AI-223.8836.35.2231.10811636
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.1.2
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

[!] An error occurred while processing the post-install hook of the Podfile.

no implicit conversion of nil into Array

/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:121:in `+'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:121:in `block (5 levels) in get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `each'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `block (4 levels) in get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `each'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `block (3 levels) in get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:105:in `each'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:105:in `block (2 levels) in get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:104:in `each'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:104:in `block in get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:102:in `each'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:102:in `get_used_required_reason_apis'
/Users/johnf/mobile/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:18:in `add_aggregated_privacy_manifest'
/Users/johnf/mobile/node_modules/react-native/scripts/react_native_pods.rb:301:in `react_native_post_install'
/Users/johnf/mobile/packages/mobile/ios/Podfile:51:in `block (3 levels) in from_ruby'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-core-1.14.3/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:149:in `message'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:183:in `integrate'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:170:in `install!'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/command/update.rb:63:in `run'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:52:in `run'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/gems/cocoapods-1.14.3/bin/pod:55:in `<top (required)>'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/bin/pod:25:in `load'
/Users/johnf/mobile/packages/mobile/vendor/bundle/ruby/3.3.0/bin/pod:25:in `<top (required)>'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:58:in `load'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:58:in `kernel_load'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli/exec.rb:23:in `run'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli.rb:451:in `exec'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli.rb:34:in `dispatch'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/cli.rb:28:in `start'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/exe/bundle:28:in `block in <top (required)>'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/bundler-2.5.7/exe/bundle:20:in `<top (required)>'
/opt/homebrew/opt/ruby/bin/bundle:25:in `load'
/opt/homebrew/opt/ruby/bin/bundle:25:in `<main>'

Reproducer

https://github.com/johnf/rn-priacy-policy-aggregation-bug

Screenshots and Videos

No response

@johnf
Copy link
Author

johnf commented May 3, 2024

I've added a reproducer

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels May 3, 2024
@cortinico
Copy link
Contributor

@aleqsio @cipolleschi can we look at this as this is a newly introduced feature?

@thespacemanatee
Copy link

This patch works for me:

diff --git a/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb b/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
index 7600829..f5fd6d5 100644
--- a/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
@@ -111,6 +111,7 @@ module PrivacyManifestUtils
                     accessed_api_types.each do |accessed_api|
                     api_type = accessed_api["NSPrivacyAccessedAPIType"]
                     reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
+                    next if api_type.nil? || reasons.nil?
                     used_apis[api_type] ||= []
                     used_apis[api_type] += reasons
                     end

@lorenc-tomasz
Copy link

I have this error when migrated from 0.73.8 to 0.74.1

[!] An error occurred while processing the post-install hook of the Podfile.

undefined method `end_with?' for nil:NilClass

/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:85:in `block in get_privacyinfo_file_path'
/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:85:in `each'
/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:85:in `find'
/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:85:in `get_privacyinfo_file_path'
/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:10:in `add_aggregated_privacy_manifest'
/Users/username/Desktop/Projects/nameA/App/node_modules/react-native/scripts/react_native_pods.rb:301:in `react_native_post_install'
/Users/username/Desktop/Projects/nameA/App/ios/Podfile:52:in `block (3 levels) in from_ruby'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in `message'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:in `integrate'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in `install!'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in `run'
/Users/username/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.15.2/bin/pod:55:in `<top (required)>'
/Users/username/.rbenv/versions/2.7.6/bin/pod:23:in `load'
/Users/username/.rbenv/versions/2.7.6/bin/pod:23:in `<main>'

@lorenc-tomasz
Copy link

I have created ticket with patch-file for mine issue: #44437

@rodrigodiasf1984
Copy link

Same issue react-native 0.74.1

Generating Pods project
Setting USE_HERMES build settings
Setting REACT_NATIVE build settings
[Ccache]: Removing Ccache from CC, LD, CXX & LDPLUSPLUS build settings
[Privacy Manifest Aggregation] Appending aggregated reasons to existing PrivacyInfo.xcprivacy file.
[Privacy Manifest Aggregation] Reading .xcprivacy files to aggregate all used Required Reason APIs.
[!] An error occurred while processing the post-install hook of the Podfile.

no implicit conversion of nil into Array

/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:115:in +' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:115:in block (5 levels) in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in each' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in block (4 levels) in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in each' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in block (3 levels) in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:105:in each' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:105:in block (2 levels) in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:104:in each' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:104:in block in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:102:in each' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:102:in get_used_required_reason_apis'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:18:in add_aggregated_privacy_manifest' /Users/rodrigodiasdefigueiredo/Desktop/parksharing/node_modules/react-native/scripts/react_native_pods.rb:301:in react_native_post_install'
/Users/rodrigodiasdefigueiredo/Desktop/parksharing/ios/Podfile:36:in block (3 levels) in from_ruby' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in post_install!'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:in run_podfile_post_install_hook' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in block in run_podfile_post_install_hooks'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in message' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in run_podfile_post_install_hooks'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:in block (2 levels) in create_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in write!'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:in block in create_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in section'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:in create_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in generate_pods_project'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:in integrate' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in install!'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in run' /opt/homebrew/lib/ruby/gems/3.3.0/gems/claide-1.1.0/lib/claide/command.rb:334:in run'
/opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in run' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/bin/pod:55:in <top (required)>'
/usr/local/bin/pod:25:in load' /usr/local/bin/pod:25:in

'

@aleqsio
Copy link
Contributor

aleqsio commented May 7, 2024

@rodrigodiasf1984

You can turn off the privacy manifest aggregation by adding privacy_file_aggregation_enabled: false to use_react_native! in your Podfile.

The fix for your issue should land in the next patch release.

@rodrigodiasf1984
Copy link

privacy_file_aggregation_enabled: false

something like this?

use_react_native!( privacy_file_aggregation_enabled: false :path => config[:reactNativePath], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." )

@cipolleschi
Copy link
Contributor

duplicated of #44400

@cortinico cortinico added Resolution: Duplicate and removed Needs: Triage 🔍 Needs: Attention Issues where the author has responded to feedback. labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants