Giter VIP home page Giter VIP logo

Comments (18)

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024 16

Mine patch file:

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..7fd3d61 100644
--- a/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
@@ -21,6 +21,7 @@ module PrivacyManifestUtils
         get_core_accessed_apis.each do |accessed_api|
             api_type = accessed_api["NSPrivacyAccessedAPIType"]
             reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
+            next if api_type.nil? || reasons.nil?
             required_reason_apis[api_type] ||= []
             required_reason_apis[api_type] += reasons
         end
@@ -29,6 +30,7 @@ module PrivacyManifestUtils
         (privacy_info["NSPrivacyAccessedAPITypes"] || []).each do |accessed_api|
             api_type = accessed_api["NSPrivacyAccessedAPIType"]
             reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
+            next if api_type.nil? || reasons.nil?
             # Add reasons from existing PrivacyInfo file to the ones from pods
             required_reason_apis[api_type] ||= []
             required_reason_apis[api_type] += reasons
@@ -67,7 +69,7 @@ module PrivacyManifestUtils
     end
 
     def self.ensure_reference(file_path, user_project, target)
-        reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
+        reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
         unless reference_exists
             # We try to find the main group, but if it doesn't exist, we default to adding the file to the project root – both work
             file_root = user_project.root_object.main_group.children.find { |group|
@@ -79,9 +81,11 @@ module PrivacyManifestUtils
     end
 
     def self.get_privacyinfo_file_path(user_project, targets)
+        puts "Debug: Entering get_privacyinfo_file_path function"
         file_refs = targets.flat_map { |target| target.resources_build_phase.files_references }
-        existing_file = file_refs.find { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
+        existing_file = file_refs.find { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
         if existing_file
+            puts "Debug: Found existing file: #{existing_file.real_path}"
             return existing_file.real_path
         end
 
@@ -90,9 +94,11 @@ module PrivacyManifestUtils
         if info_plist_path.nil?
             # return path that is sibling to .xcodeproj
             path = user_project.path
-            return File.join(File.dirname(path), "PrivacyInfo.xcprivacy")
+            puts "Debug: info_plist_path is nil, using user_project.path: #{path}"
+            return File.join(File.dirname(path), "PrivacyInfo.xcprivacy") unless path.nil?
         end
-        return File.join(File.dirname(info_plist_path.real_path),"PrivacyInfo.xcprivacy")
+        puts "Debug: Found info_plist_path: #{info_plist_path.real_path}"
+        return File.join(File.dirname(info_plist_path.real_path),"PrivacyInfo.xcprivacy") unless info_plist_path.real_path.nil?
     end
 
     def self.get_used_required_reason_apis(installer)
@@ -111,6 +117,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

from react-native.

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024 3

@aleqsio @cipolleschi can you look at this, please? :)

from react-native.

cipolleschi avatar cipolleschi commented on June 12, 2024 3

@david-cahill Likely next week. We have been busy working on the React Conf the past two weeks, so we could not dedicate any time to anything else, unfortunately. This week we have internal events plus the AppJS conf that are going to slow down the releases a bit. Next week we should be back to normal.

from react-native.

cipolleschi avatar cipolleschi commented on June 12, 2024 2

We have a fix ready with #44400. It has landed already in main, we need to release patched versions of React Native.

I'll keep the issue open for discoverability.

from react-native.

aleqsio avatar aleqsio commented on June 12, 2024 2

I think we're looking to merge #44410 to fix this issue, no?

from react-native.

radko93 avatar radko93 commented on June 12, 2024 1

I can confirm it's happening for me, latest Xcode and MacOs.

from react-native.

renchap avatar renchap commented on June 12, 2024 1

Same for me although slightly different error:-

[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.

undefined method 'each' for nil:NilClass

/Users/x/Development/x/mobile_v3/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in 'block (4 levels) in get_used_required_reason_apis'
/Users/x/Development/x/mobile_v3/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in 'each'

Reverting back to RN 0.74.0 and all is fine.

I assume Apple will reject any submissions as we're past the 1st of May deadline for getting the privacy manifest sorted out and 0.74.0 wasn't merging these properly in the first place (from other 3rd party libs)?

I am seeing the same error, and this has not been fixed by the linked PRs, so here is another one for this specific issue (manifest without a NSPrivacyAccessedAPITypes key): #44628

from react-native.

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024

Added repro repo :)

from react-native.

soarb avatar soarb commented on June 12, 2024

Same for me although slightly different error:-

[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.

undefined method 'each' for nil:NilClass

/Users/x/Development/x/mobile_v3/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:111:in 'block (4 levels) in get_used_required_reason_apis'
/Users/x/Development/x/mobile_v3/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb:106:in 'each'

Reverting back to RN 0.74.0 and all is fine.

I assume Apple will reject any submissions as we're past the 1st of May deadline for getting the privacy manifest sorted out and 0.74.0 wasn't merging these properly in the first place (from other 3rd party libs)?

from react-native.

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024

Hi @cipolleschi,
44400 closes issue with Dic. The mentioned issue here is connected with get_privacyinfo_file_path and I have no idea why file_refs doesn't have a path property.

from react-native.

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024

Thank you for answer @aleqsio. I didn't notice this PR :(

from react-native.

david-cahill avatar david-cahill commented on June 12, 2024

@cipolleschi Any idea when this might be released? Thanks!

from react-native.

lorenc-tomasz avatar lorenc-tomasz commented on June 12, 2024

@david-cahill Likely next week. We have been busy working on the React Conf the past two weeks, so we could not dedicate any time to anything else, unfortunately. This week we have internal events plus the AppJS conf that are going to slow down the releases a bit. Next week we should be back to normal.

I wanted to go to the App JS conference (2 hours by car) but the company refused my request :(

from react-native.

Willham12 avatar Willham12 commented on June 12, 2024

For me this did the fix:

 next if accessed_api_types.nil? || accessed_api_types.nil?

from react-native.

salah-ghanim avatar salah-ghanim commented on June 12, 2024

so .. this was an issue for the react-native-maps project as well, it seems like by updating to react-native 0.74.1 from react-native 0.74.0 there are more strict checks for privacy manifest file content, ie both NSPrivacyCollectedDataTypes and NSPrivacyAccessedAPITypes were needed.

we included both and pod install is now working as expected.

so I'm not sure if this is really a bug in react-native itself or simply a better PrivacyPolicy file is expected

from react-native.

najumasad avatar najumasad commented on June 12, 2024

Mine patch file:

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..7fd3d61 100644
--- a/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/privacy_manifest_utils.rb
@@ -21,6 +21,7 @@ module PrivacyManifestUtils
         get_core_accessed_apis.each do |accessed_api|
             api_type = accessed_api["NSPrivacyAccessedAPIType"]
             reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
+            next if api_type.nil? || reasons.nil?
             required_reason_apis[api_type] ||= []
             required_reason_apis[api_type] += reasons
         end
@@ -29,6 +30,7 @@ module PrivacyManifestUtils
         (privacy_info["NSPrivacyAccessedAPITypes"] || []).each do |accessed_api|
             api_type = accessed_api["NSPrivacyAccessedAPIType"]
             reasons = accessed_api["NSPrivacyAccessedAPITypeReasons"]
+            next if api_type.nil? || reasons.nil?
             # Add reasons from existing PrivacyInfo file to the ones from pods
             required_reason_apis[api_type] ||= []
             required_reason_apis[api_type] += reasons
@@ -67,7 +69,7 @@ module PrivacyManifestUtils
     end
 
     def self.ensure_reference(file_path, user_project, target)
-        reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
+        reference_exists = target.resources_build_phase.files_references.any? { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
         unless reference_exists
             # We try to find the main group, but if it doesn't exist, we default to adding the file to the project root – both work
             file_root = user_project.root_object.main_group.children.find { |group|
@@ -79,9 +81,11 @@ module PrivacyManifestUtils
     end
 
     def self.get_privacyinfo_file_path(user_project, targets)
+        puts "Debug: Entering get_privacyinfo_file_path function"
         file_refs = targets.flat_map { |target| target.resources_build_phase.files_references }
-        existing_file = file_refs.find { |file_ref| file_ref.path.end_with? "PrivacyInfo.xcprivacy" }
+        existing_file = file_refs.find { |file_ref| file_ref.path&.end_with? "PrivacyInfo.xcprivacy" }
         if existing_file
+            puts "Debug: Found existing file: #{existing_file.real_path}"
             return existing_file.real_path
         end
 
@@ -90,9 +94,11 @@ module PrivacyManifestUtils
         if info_plist_path.nil?
             # return path that is sibling to .xcodeproj
             path = user_project.path
-            return File.join(File.dirname(path), "PrivacyInfo.xcprivacy")
+            puts "Debug: info_plist_path is nil, using user_project.path: #{path}"
+            return File.join(File.dirname(path), "PrivacyInfo.xcprivacy") unless path.nil?
         end
-        return File.join(File.dirname(info_plist_path.real_path),"PrivacyInfo.xcprivacy")
+        puts "Debug: Found info_plist_path: #{info_plist_path.real_path}"
+        return File.join(File.dirname(info_plist_path.real_path),"PrivacyInfo.xcprivacy") unless info_plist_path.real_path.nil?
     end
 
     def self.get_used_required_reason_apis(installer)
@@ -111,6 +117,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

thanks @lorenc-tomasz patch also worked for me

from react-native.

cipolleschi avatar cipolleschi commented on June 12, 2024

Version 0.74.2 of React Native is out with all the fixes to the privacy manifest. Patches for versions 0.73 and 0.72 will come in the next few days with similar fixes!

from react-native.

radko93 avatar radko93 commented on June 12, 2024

Thanks @cipolleschi, I updated and it's all good!

from react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.