From d3175f787112c384f960b70345a6dde788330f8f Mon Sep 17 00:00:00 2001 From: Stefan Wrobel Date: Thu, 2 May 2024 18:00:31 -0700 Subject: [PATCH] Add nil check to privacy manifest generation --- .../scripts/cocoapods/privacy_manifest_utils.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb b/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb index 2f4cac1f8bab..35229c481f19 100644 --- a/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb +++ b/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb @@ -106,10 +106,11 @@ def self.get_used_required_reason_apis(installer) content = Xcodeproj::Plist.read_from_path(file_path) accessed_api_types = content["NSPrivacyAccessedAPITypes"] accessed_api_types.each do |accessed_api| - api_type = accessed_api["NSPrivacyAccessedAPIType"] - reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"] - used_apis[api_type] ||= [] - used_apis[api_type] += reasons + api_type = accessed_api["NSPrivacyAccessedAPIType"] + reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"] + next unless api_type + used_apis[api_type] ||= [] + used_apis[api_type] += reasons end end end