阅读 818

ReactNative报错:Cycle inside FBReactNativeSpec

报错信息如下:

Cycle inside FBReactNativeSpec; building could produce unreliable results. This usually can be resolved by moving the shell script phase '[CP-User] Generate Specs' so that it runs before the build phase that depends on its outputs.
Cycle details:
→ Target 'FBReactNativeSpec' has link command with output '/Users/wangbaoxiang/Library/Developer/Xcode/DerivedData/Project-gsmkalbsqetinifxsldxkckelfrz/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/FBReactNativeSpec'
○ Target 'FBReactNativeSpec' has compile command with input '/Users/wangbaoxiang/Desktop/ReactNativeApp/ios/Project/Pods/Target Support Files/FBReactNativeSpec/FBReactNativeSpec-dummy.m'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”
○ Target 'FBReactNativeSpec' has copy command from '/Users/wangbaoxiang/Desktop/ReactNativeApp/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h' to '/Users/wangbaoxiang/Library/Developer/Xcode/DerivedData/Project-gsmkalbsqetinifxsldxkckelfrz/Build/Products/Debug-iphoneos/FBReactNativeSpec/FBReactNativeSpec.framework/Headers/FBReactNativeSpec.h'
○ That command depends on command in Target 'FBReactNativeSpec': script phase “[CP-User] Generate Specs”
复制代码

两种解决方案:

  1. 修改XcodeBuild System为:Legacy Build System

Xcode->File->Workspace Settings->Build System

  1. Podfile文件中添加以下代码:
# need to move 'Generate Specs' build_phase to be first for FBReactNativeSpec
post_install do |installer|
    installer.pods_project.targets.each do |target|
      if (target.name&.eql?('FBReactNativeSpec'))
        target.build_phases.each do |build_phase|
          if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
复制代码

然后执行pod install

文章分类
iOS
文章标签