This guide explains how to build and upload your iOS app to the App Store or TestFlight, or run it locally during development with custom native dependencies.
You'll use the prebuild
command to generate the native code and Xcode project for iOS, open it with Xcode, and either run the app or archive it for distribution.
Note: If you just want to run your iOS app in development mode without any custom native dependencies, you don't need this guide. All you need is an iOS device with Expo Go installed. It should auto-detect from your simulator, or press q, r in your terminal which is running the One dev server and follow the instructions to open the app in Expo Go.
Before you can run or build your iOS app, you'll need to generate the native code and Xcode project for iOS.
First, ensure the prebuild:native
script is defined in your package.json
:
Next, run the following command in your terminal:
npm run prebuild:native
This command may prompt you with some questions and could take a few minutes to install CocoaPods dependencies on it's first run.
Once finished, your iOS project will be available in the ./ios
directory and ready for use.
To run the app, open the .xcworkspace
file in the ./ios
directory. The filename will vary based on your app's name, but you can generally open it by running this command:
Terminal
Once Xcode opens, ➊ choose a simulator or physical device, and ➋ click the run button to build and launch the app.
Open the .xcworkspace file from the ios directory. You can do this by running the following command:
Terminal
Once Xcode opens, follow these steps:
Once code signing is set up, click "Product" → "Archive" on the menu bar to start the Archive process.
After the archive process completes, Xcode will automatically open the Organizer window with your build. From there, click "Distribute App" to upload the app to the App Store or TestFlight.
npx one
.You should add a react-native.config.cjs
file in your project root to configure React Native to use Vite as the JS bundler during the native build process:
By doing so, the react-native build
command will be overwritten to use Vite as the JS bundler instead of Metro.
@react-native-community/cli
package to make this work. For the patch to apply, you'll need to start the dev server at least once.If you're using Expo Prebuild, you should also add "vxrn/expo-plugin"
in your app config (app.json/app.config.js/app.config.ts):
vxrn/expo-plugin
already takes care of this.In the "Bundle React Native code and images" phase, make the following change in the shell script:
Terminal
ios/*.xcworkspace
isn't thereTry cd ios && pod install && cd ..
.
node: No such file or directory
during Xcode buildThis often comes with Node found at: /private/var/folders/.../T/xfs-.../node
and then /private/var/folders/.../T/xfs-.../node: No such file or directory
.
Try to delete ios/.xcode.env.local
.
No Metro config found
Make sure there's a react-native.config.cjs
in your project which contains something like this:
Make sure you have vxrn/expo-plugin
included in your app.json
(or .js, etc.):
Try to delete the ios
directory and run prebuild
again.
Edit this page on GitHub.