React Native XCode Project Product Archive Fails with duplicate symbols for architecture arm64

So I did even more research into this and the workaround is actually much simpler. Or at least it was in my case. The problem is that when you declare React in the podfile, the Pods xcodeproject gets a React target as part of the pod install process. Having this target in the Pods project is what causes the error when you Archive. So the fix is to remove the target.

enter image description here

The problem with removing the target in xCode is that this actually edits project.pbxproj file within the Pods folder which is not in version control. So while the build will archive once you do this, if you deploy from anywhere other than the machine that manually removed it, it will still fail. So the solution is to add this post install command to the bottom of your podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

This simply loops through all the pods to be installed and removes the target for the React one. This way anywhere that builds the project, will also remove the target. Now when you build to Archive it will not fail.

Leave a Comment