How to fix React Native App not building for iOS

眉间皱痕 提交于 2021-02-08 18:27:32

问题


I'm having trouble building my react native app for iOS. For android it builds perfectly fine. For iOS, the project will build but not archive. Here is the error code when attempting to archive my project:

1) Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
2) Target 'React-Core.common-CoreModulesHeaders-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

Few things to state: Running React-native 0.63, Podfile and deployment targets are all on 11

Edit: when running from the command line I receive this error

      '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-bzowsupbiktzuzaaadvokqxbgvzq/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/BuildProductsPath/Release-iphoneos/YogaKit/YogaKit.modulemap'
      not found```

回答1:


I fixed this error by deleting 'React-Core.common-AccessibilityResources' from my pod targets. When attempting to archive, make sure you are not using .xcodeproj and using your workspace. Even if you think you are using workspace triple check. Also if you try archiving through the command line you must specifically state workspace.




回答2:


EDIT : I fixed the build issue by removing ONLY React-Core.common-AccessibilityResources from the targets using my Podfile.

(I wanted to reply to Jake's answer, but I don't have enough reputation to comment yet)

I have tried modifying my Podfile to exclude these two targets (React-Core.common-AccessibilityResources and React-Core.common-CoreModulesHeaders-AccessibilityResources) from the Pods project. It starts compiling but it still ends up failing saying that AccessibilityResources.bundle does not exist.

While switching to the Legacy Build system (in workspace settings) seems to fix the AccessibilityResources issue, other issues arise (mainly about Swift libraries, even if the bridge is enabled)...

I've also tried to delete my Pods folder and do a clean install, but unfortunately, this did not work.




回答3:


For anyone who is not very experienced with Pods, add the following lines to your Podfile (RN 0.63.2):

target 'yourapp' do

  # your pods go here

  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])


  # Enables Flipper.
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.

  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)

    ################### ADD THE FOLLOWING #########################
    installer.pods_project.targets.each do |target|
      if target.name == "React-Core.common-AccessibilityResources"
        target.remove_from_project
      end
    end
    ###############################################################

  end
end


来源:https://stackoverflow.com/questions/63082833/how-to-fix-react-native-app-not-building-for-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!