I'm working on a React Native app using Expo, and I've successfully built the APK for Android but am facing issues with building for iOS. The app is essentially just the Expo template. My GitHub Actions workflow fails when trying to build for iOS. I'm particularly interested in using the artifacts generated by the workflow.
Here is the relevant part of my GitHub Actions workflow:
- name: Install CocoaPods dependencies
run: |
cd ios
pod setup
pod cache clean --all
pod install
Here is the almost complete workflow
jobs:
prepare-js-bundle-ios:
name: Prepare JavaScript Bundle with Metro for iOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Watchman
uses: actions/cache@v3
with:
path: |
/usr/local/Cellar/watchman
key: ${{ runner.os }}-watchman-${{ hashFiles('**/Brewfile.lock.json') }}
restore-keys: |
${{ runner.os }}-watchman-
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: '21'
- name: Install Watchman
run: |
if ! watchman --version; then
brew install watchman
else
echo "Watchman is already installed."
fi
- name: Setup CocoaPods
run: |
sudo gem install cocoapods
sudo gem update cocoapods
- name: Install Xcode Command Line Tools
run: xcode-select --install || true # The `|| true` ensures that if command line tools are already installed, the workflow doesn't fail.
- name: Install npm dependencies
run: npm i
- name: Bundle JavaScript with Metro for iOS
run: |
npx expo prebuild -p ios
npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios
- name: Update Podfile platform version
run: |
sed -i '' "s/^platform :ios,.*/platform :ios, '13.4'/" ios/Podfile
- name: Modify Podfile
run: |
echo "use_modular_headers!" >> ios/Podfile
- name: Install CocoaPods dependencies
run: |
cd ios
pod setup
pod cache clean --all
pod install
- name: Build iOS app (Xcode build)
run: |
cd ios
xcodebuild -workspace wordguesser-app.xcworkspace -scheme wordguesser-app -configuration Release -sdk iphoneos BUILD_LIBRARY_FOR_DISTRIBUTION=YES
and finally the error i get:
Setting REACT_NATIVE build settings
[!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `83FE304946FB4310A55A14A4` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /Users/runner/work/wordguesser-app/wordguesser-app/ios/myapp.xcodeproj
Pod install took 150 [s] to run
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `__apply_Xcode_12_5_M1_post_install_workaround' for #<Pod::Podfile:0x00007fbab12f82a8 @defined_in_file=#<Pathname:/Users/runner/work/wordguesser-app/wordguesser-app/ios/Podfile>, @internal_hash={"installation_method"=>{"name"=>"cocoapods", "options"=>{:deterministic_uuids=>false}}}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>, @post_install_callback=#<Proc:0x00007fbab1912f80 /Users/runner/work/wordguesser-app/wordguesser-app/ios/Podfile:60>, @post_integrate_callback=#<Proc:0x00007fbab1912f08 /Users/runner/work/wordguesser-app/wordguesser-app/ios/Podfile:80>, @installation_options=#<Pod::Installer::InstallationOptions:0x00007fbaae4ee970 @clean=true, @deduplicate_targets=true, @deterministic_uuids=false, @integrate_targets=true, @lock_pod_sources=true, @warn_for_multiple_pod_sources=true, @warn_for_unused_master_specs_repo=true, @share_schemes_for_development_pods=false, @disable_input_output_paths=false, @preserve_pod_file_structure=false, @generate_multiple_pod_projects=false, @incremental_installation=false, @skip_pods_project_generation=false, @parallel_pod_downloads=false, @parallel_pod_download_thread_pool_size=40>>
app.json
{
"expo": {
"name": "my-app",
"slug": "my-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"bundleIdentifier": "com.test.test",
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "com.sebastian.arthur.kull.test"
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
I'm unsure how to resolve this issue. It seems like there's a problem with CocoaPods or the Podfile, but I can't pinpoint the exact cause or how to fix it. Any insights or solutions would be greatly appreciated!