【问题标题】:Unable to Archive ReactNative project in Mac M1无法在 Mac M1 中存档 ReactNative 项目
【发布时间】:2021-10-12 20:50:47
【问题描述】:

当我尝试存档时,我收到以下错误 -

Multiple commands produce '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle':

1) Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

2) Target 'React-Core.common-Hermes-AccessibilityResources' has create directory command with output '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/ArchiveIntermediates/project/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

如果我从 Pod 中删除 React-Core.common-AccessibilityResources,共享扩展不会构建并声明它需要此 Pod。

我正在使用的堆栈 -

RN - 0.64.2
React - 17.0.1
Node - 14.17.3
npm - 7.5.0
Xcode - 12.5.1
Macbook Air M1

【问题讨论】:

    标签: ios reactjs swift xcode react-native


    【解决方案1】:

    Podfile 中的目标中删除React-Core.common-AccessibilityResources 修复了该问题。

    ...
    use_flipper!
    post_install do |installer|
      flipper_post_install(installer)
    
      installer.pods_project.targets.each do |target|
        if target.name == "React-Core.common-AccessibilityResources"
          target.remove_from_project
        end
      end
    end
    ...
    

    如果这不起作用,试试这个:

    我通过从我的 pod 目标中删除“React-Core.common-AccessibilityResources”来修复此错误。尝试存档时,请确保您没有使用 .xcodeproj 并使用您的工作区。即使您认为您正在使用工作区三重检查。此外,如果您尝试通过命令行存档,则必须明确说明工作空间。

    学分: How to fix React Native App not building for iOS

    Xcode 12 Error: Multiple commands produce AccessibilityResources.bundle

    【讨论】:

    • 我也有一个 ShareExtension,因为我的应用程序接受文本作为分享点。如果我删除“React-Core.common-AccessibilityResources”,ShareExtension 不会构建。
    【解决方案2】:

    我发现,共享扩展的 ReactNative 配置与导入依赖项两次的主应用不同。

    这是来自 PodFile 的 sn-p

    target 'project' do 
      ...
      use_react_native!(
        :path => config[:reactNativePath],
        :hermes_enabled => true
      )
    
      ...
    end
    
    target 'shareExtension' do
      ...
      use react_native!
      ...
    end
    

    对于共享扩展,我用这个替换了配置

    target 'shareExtesion' do
      use_react_native!(
        :path => config[:reactNativePath],
        :hermes_enabled => true
      )
    
      ...
    end
    

    Podfile 中进行此更改后,进行必要的清理,pod install 并且工作正常。

    【讨论】:

      猜你喜欢
      • 2021-06-10
      • 1970-01-01
      • 2021-06-14
      • 2021-05-20
      • 2022-08-05
      • 2022-11-13
      • 1970-01-01
      • 1970-01-01
      • 2022-08-24
      相关资源
      最近更新 更多