azure devops React Native IOS构建RCTAppDelegate.h'文件未找到错误

问题描述 投票:0回答:1

我在 React Native 应用程序的 IOS 构建的 DevOps 管道中遇到此错误

RCTAppDelegate.h' 文件未找到

/Users/runner/work/1/s/ios/MyNewApp/AppDelegate.h:1:9: 找不到“RCTAppDelegate.h”文件

编译C /Users/runner/Library/Developer/Xcode/DerivedData/MyNewApp-ajfktijvrkpgmscslwbprnszgveb/Build/Intermediates.noindex/MyNewApp.build/Release-iphonesimulator/MyNewApp.build/Objects-normal/x86_64/AppDelegate.o

/Users/runner/work/1/s/ios/MyNewApp/AppDelegate.mm 正常 x86_64 Objective-C++ com.apple.compilers.llvm.clang.1_0.compiler(在目标中 项目“MyNewApp”中的“MyNewApp”)(1 次失败)

有人可以帮我吗?

管道定义如下:

trigger:
- Integration
variables:
- group: Mobile
pool:
  vmImage: macos-latest
steps:
- checkout: self
  persistCredentials: true
  clean: true
- task: NodeTool@0
  inputs:
    versionSpec: '20.x'
  displayName: 'Install Node.js'
- script: |
    yarn install
  displayName: 'yarn install and build'
- script: |
    yarn bundle:ios
  displayName: 'RN build'
- task: InstallAppleCertificate@2
  inputs:
    certSecureFile: 'DistCertfr2024.p12'
    certPwd: '$(AppleCertPassword)'
    keychain: 'temp'
    deleteCert: true
- task: InstallAppleProvisioningProfile@1
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'fr2024ProvisioningV1.mobileprovision'
    removeProfile: true
- script: |
    cd ios
    pod install
    xcodebuild -showsdks
  displayName: 'Install CocoaPods dependencies'
- task: Xcode@5
  inputs:
    actions: 'build'
    sdk: 'iphonesimulator' 
    scheme: 'MyNewApp'
    packageApp: true
    signingOption: 'manual'
    provisioningProfileName: 'fr2024ProvisioningV1'
    configuration: 'Release'
    xcWorkspacePath: 'ios/MyNewApp.xcodeproj'
    exportPath: 'output'
    destinationPlatformOption: default
- task: CopyFiles@2
  inputs:
    Contents: '**/*.ipa'
    TargetFolder: '$(build.ArtifactStagingDirectory)'
    OverWrite: true
    flattenFolders: true
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'ios'
    publishLocation: 'Container'

yarn bundle:ios
脚本翻译为:

"bundle:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/MyNewApp/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
react-native azure-devops azure-pipelines-build-task
1个回答
0
投票

/Users/runner/work/1/s/ios/MyNewApp/AppDelegate.h:1:9:找不到“RCTAppDelegate.h”文件

要解决这个问题,我们需要在 Xcode 任务 -> xcWorkspacePath 字段中设置 .xcworkspace 文件而不是 .xcodeproj 文件。

例如:

- task: Xcode@5
  inputs:
    actions: 'build'
    sdk: 'iphonesimulator' 
    scheme: 'MyNewApp'
    packageApp: true
    signingOption: 'manual'
    provisioningProfileName: 'fr2024ProvisioningV1'
    configuration: 'Release'
    xcWorkspacePath: 'ios/MyNewApp.xcworkspace'
    exportPath: 'output'
    destinationPlatformOption: default
© www.soinside.com 2019 - 2024. All rights reserved.