MIPB
MIPB

Reputation: 2471

Multiple commands produce PrivacyInfo.xcprivacy

I am trying to build my app for iOS (using react-native), and I keep getting the error Multiple commands produce PrivacyInfo.xcprivacy.

I know where the error comes from, it's related to the fact that the Toast Pod has an PrivacyInfo.xcprivacy file:

Toast Pod

But I also have one for my app, because otherwise Apple won't accept my app starting 1st of May 2024.

They are colliding, because the files are named the same, but Apple's guidelines are strict in that sense, the file must be named this way, so I cannot rename mine.

My temporary solution has been to delete the Toast privacy file (not just removing the reference, deleting it), but I feel there has to be an actual solution for this (like a way to merge both files).

Has anyone encountered a similar problem?

Thanks

Upvotes: 13

Views: 5121

Answers (4)

delki8
delki8

Reputation: 429

I had to use a combination of things for this one, and I still need a way to make them permanent. But this is how I fixed it.

for context, this is small react-native app, recently upgraded to 0.76.2. I'm adding OneSignal to have push notifications on it. The build on my phone works, build archiving was failing with the following:

Multiple commands produce '/Users/{computer}/Library/Developer/Xcode/DerivedData/{project}-cfqkxykyribsykcjmylvrrqqveqa/ArchiveIntermediates/{project}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/React-Core_privacy.bundle'

Under "Pods" on my Project Navigator, there were two pods each trying to copy the same "React-Core_privacy.bundle": "React-Core.common-CoreModulesHeaders-React-Core_privacy" and "React-Core.common-React-Core_privacy".

I've found that the one used by the new OneSignalNotificationServiceExtension target was the latter, so I removed the 'React-Core.common-React-Core_privacy' Pod from the 'Pods' menu. After that I started getting a 'not found' error from the OneSignalNotificationServiceExtension target. So I selected the OneSignal target (by first clicking on the project's name), going to the 'Build Phases' tab, opening [CP] Copy Pods Resources, opening the resources shell script (mine was "${PODS_ROOT}/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension-resources.sh").

This is the script that is giving me the 'not found' error.

Under it I've looked for the 'React-Core_privacy.bundle' file. I've found two lines copying it, one under a DEBUG block, and the other under a "RELEASE" block, like install_resource "${PODS_CONFIGURATION_BUILD_DIR}/React-Core.common/React-Core_privacy.bundle".

I removed them both and the build succeeded. I hope this helps someone.

Upvotes: 0

Florin Dobre
Florin Dobre

Reputation: 10252

In my case a google-cast-sdk pod was generating that file.

But the file was also copied in the project target copy bundle resources phase in Build phases.

I removed it from project target -> build phases -> copy bundle resources phase and the app built successfully.

enter image description here

Upvotes: 1

VictorJi
VictorJi

Reputation: 339

Finally, I found the solution.

  1. Open

/Pods/Target Support Files/Pods-TargetName/Pods-TargetName-resources.sh

search for PrivacyInfo.xcprivacy, and you can see which library incorrectly copied the PrivacyInfo.xcprivacy file to the main bundle.

  1. Then there are two ways:

(1) Check if the library has a newer version. If it does, update it and try again. The issue may have been resolved in the new version.

(2) If there is no newer version or the new version does not resolve the issue, download the source code directly. Modify the podspec file of this library and change

"resources": "LibName/PrivacyInfo.xcprivacy"

to

"resource_bundles": {"LibName": "LibName/PrivacyInfo.xcprivacy"}

(3) In your project's Podfile, change

pod "LibName"

to your local path, like

pod "LibName", :path =>'Your Local Path'

(4)run pod update and try again

Upvotes: 12

Muhammad
Muhammad

Reputation: 19

You need to add PrivacyInfo.xcprivacy in project target.

Upvotes: -2

Related Questions