'React/RCTUtils.h' 找不到文件

'React/RCTUtils.h' file not found

我正在使用 xcode 构建 android 应用程序。在 azure devops 管道中;在构建时我收到此错误:

▸ Compiling PdfManager.m

❌  /Users/runner/runners/2.166.3/work/1/s/node_modules/react-native-pdf/ios/RCTPdf/PdfManager.m:16:9: 'React/RCTUtils.h' file not found

#import "React/RCTUtils.h"
                                       ^~~~~~~~~~~


▸ Compiling RCTPdfPageViewManager.m
▸ Compiling RCTPdfPageView.m
▸ Compiling RCTPdfView.m
** BUILD FAILED **


The following build commands failed:
    CompileC /Users/runner/Library/Developer/Xcode/DerivedData/helloapp-awmfiqdyvoywmpfazxztxqjlmzar/Build/Intermediates.noindex/Pods.build/Release-iphoneos/react-native-pdf.build/Objects-normal/armv7/PdfManager.o /Users/runner/runners/2.166.3/work/1/s/node_modules/react-native-pdf/ios/RCTPdf/PdfManager.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65

找不到原因,需要一些帮助,我的 podfile 是:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'helloapp' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for helloapp
   pod 'Firebase/Core'
   pod 'Firebase/Messaging' 

 pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

 pod 'react-native-pdf', :path => '../node_modules/react-native-pdf'


 target 'helloappTests' do
    inherit! :search_paths
    # Pods for testing
  end

end
post_install do |installer|
        installer.pods_project.build_configurations.each do |config|
            config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
            config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
end

和我的 azure pipeline yaml 任务,在此我安装了 pods 使用 cocoapods:

trigger:
- master

pool:
  vmImage: 'macos-latest'

variables:
  - group: abcd

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '9.7.1'
  displayName: 'Install Node'
- script: npm install
  displayName: 'Install dependencies'

- task: InstallAppleCertificate@2
  inputs:
   certSecureFile: '$(file)'
   certPwd: '$(Pass)'
   keychain: 'temp'
   deleteCert: true  

- task: InstallAppleProvisioningProfile@1
  inputs:
   provisioningProfileLocation: ''
   provProfileSecureFile: '$(provisioningProfile)'
   removeProfile: true

- task: Cache@2
  inputs:
   key: 'pods | "$(Agent.OS)" | Podfile.lock'
   path: 'pods'
- task: CocoaPods@0
  inputs:
    forceRepoUpdate: true
    projectDirectory: '$(system.defaultWorkingDirectory)'
  displayName: 'pod install using the CocoaPods'

- task: Xcode@5
  inputs:
    workingDirectory: 'ios'
    actions: 'build'
    scheme: 'helloapp'
    sdk: 'iphoneos'
    configuration: 'Release'
    xcWorkspacePath: '**/helloapp.xcworkspace'
    xcodeVersion: 'default'
    packageApp: true
    signingOption: 'manual'
    signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
    provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
    args: '-UseModernBuildSystem=0'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(build.artifactStagingDirectory)'
  inputs:
    SourceFolder: ''
    contents: '**/*.ipa'
    targetFolder: '$(build.artifactStagingDirectory)'
    overWrite: true

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(build.ArtifactStagingDirectory)'
    artifactName: 'drop' 
    publishLocation: 'Container'

pod 安装任务输出,即由 cocoapods 添加到安装 pods 的任务的日志pods:

Version      : 0.151.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.9.1
/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update --project-directory=/Users/runner/runners/2.166.3/work/1/s/ios
Updating local specs repositories
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
Analyzing dependencies
Downloading dependencies
Installing React (0.11.0)
Installing react-native-pdf (5.0.12)
Installing rn-fetch-blob (0.10.6)
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 14 total pods installed.

[!] Automatically assigning platform `iOS` with version `9.0` on target `helloapp` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] The `helloappTests [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-helloappTests/Pods-helloapp.debug.xcconfig'. This can lead to problems with the CocoaPods installation

[!] The `helloappTests [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods-helloappTests/Pods-helloappTests.release.xcconfig'. This can lead to problems with the CocoaPods installation

[!] React has been deprecated
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.
Finishing: pod install using the CocoaPods

如果需要更多详细信息,请在评论中询问。

您提供的 podfile 缺少对 react 本身的引用,这是一个如何修复它的示例(评论中的 react-native 版本 0.58):

target 'helloapp' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # START REACT_NATIVE DEPENDENCIES
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'RCTPushNotification',
    'DevSupport'
  ]
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/GLog.podspec'
    # END REACT_NATIVE DEPENDENCIES

  # Pods for helloapp
   pod 'Firebase/Core'
   pod 'Firebase/Messaging' 

 pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

 pod 'react-native-pdf', :path => '../node_modules/react-native-pdf'


 target 'helloappTests' do
    inherit! :search_paths
    # Pods for testing
  end

end