diff --git a/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb b/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb index 7fcc3d339cc2cc..42ce104571af1d 100644 --- a/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb +++ b/packages/react-native/scripts/cocoapods/privacy_manifest_utils.rb @@ -108,11 +108,12 @@ def self.get_used_required_reason_apis(installer) if File.basename(file_path) == 'PrivacyInfo.xcprivacy' 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 + accessed_api_types&.each do |accessed_api| + 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