Skip to content

Commit a7fc0c6

Browse files
robertyingTitozzz
authored andcommitted
Fix NSAppTransportSecurity being overwritten during pod install (#41875)
Summary: This PR fixes #41874. ## Changelog: <!-- 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] - Fix NSAppTransportSecurity being overwritten during pod install Pull Request resolved: #41875 Test Plan: 1. Delete the whole `NSAppTransportSecurity` in Info.plist and run `pod install`: `NSAllowsArbitraryLoads` and `NSAllowsLocalNetworking` are added as expected. 2. Modify `NSAppTransportSecurity` to only contain `NSExceptionDomains` and run `pod install`: `NSAllowsArbitraryLoads` and `NSAllowsLocalNetworking` are added, and `NSExceptionDomains` is still there. 3. Run `pod install` again: nothing changes. Reviewed By: christophpurrer Differential Revision: D52032400 Pulled By: dmytrorykun fbshipit-source-id: 48cf29809c283af80613ffbf1ac0dc663a0a2fb5
1 parent 6230f9e commit a7fc0c6

File tree

1 file changed

+2
-1
lines changed
  • packages/react-native/scripts/cocoapods

1 file changed

+2
-1
lines changed

packages/react-native/scripts/cocoapods/utils.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ def self.update_ats_in_plist(plistPaths, parent)
560560
"NSAppTransportSecurity" => ats_configs
561561
}
562562
else
563-
plist["NSAppTransportSecurity"] = ats_configs
563+
plist["NSAppTransportSecurity"] ||= {}
564+
plist["NSAppTransportSecurity"] = plist["NSAppTransportSecurity"].merge(ats_configs)
564565
end
565566
Xcodeproj::Plist.write_to_path(plist, fullPlistPath)
566567
end

0 commit comments

Comments
 (0)