mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix Privacy Manifest generator when it does not contain a NSPrivacyAccessedAPITypes key (#44628)
Summary: XCode privacy files might not contain a `NSPrivacyAccessedAPITypes` key, which causes the following error: ``` [!] An error occurred while processing the post-install hook of the Podfile. undefined method `each' for nil node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in `block (4 levels) in get_used_required_reason_apis' node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `each' node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in `block (3 levels) in get_used_required_reason_apis' ``` <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [IOS] [FIXED] - Privacy Manifest aggregation failing due to no `NSPrivacyAccessedAPITypes` key Pull Request resolved: https://github.com/facebook/react-native/pull/44628 Test Plan: I tested this patch on our own app and it solved the issue. Reviewed By: christophpurrer Differential Revision: D57618425 Pulled By: cipolleschi fbshipit-source-id: 1a36ab5a1bb45b8507d3663b782c95258d97c8a4
This commit is contained in:
committed by
Riccardo Cipolleschi
parent
1860441d84
commit
752c173da5
@@ -108,11 +108,12 @@ module PrivacyManifestUtils
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user