i get this error in my devops pipeline for IOS build of react native app
RCTAppDelegate.h' file not found
/Users/runner/work/1/s/ios/MyNewApp/AppDelegate.h:1:9: 'RCTAppDelegate.h' file not found
CompileC /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 normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'MyNewApp' from project 'MyNewApp') (1 failure)
Can someone help me out?
pipeline def below:
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
script translates to:
"bundle:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/MyNewApp/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
/Users/runner/work/1/s/ios/MyNewApp/AppDelegate.h:1:9: 'RCTAppDelegate.h' file not found
To solve this issue, we need to set the .xcworkspace file instead of .xcodeproj file in the Xcode task -> xcWorkspacePath field.
For example:
- 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