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

后端 未结 3 858
时光说笑
时光说笑 2020-12-02 20:33

Strangely, I can\'t seem to get Archive to work in XCode but the build succeeds without the errors on duplicate symbols if I do not attempt to Archive but simply bu

3条回答
  •  被撕碎了的回忆
    2020-12-02 21:07

    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.

    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.

提交回复
热议问题