Build and debug React Native iOS apps on Windows
Build, install and debug the native side on Windows while Metro runs the JavaScript as usual.
Build the iOS side of a React Native project on Windows and debug it on your iPhone. Run Metro for the JS as usual, and set breakpoints in native code. Build scripts in your project that call xcodebuild work without changes. See xcodebuild and xcrun compatibility.
Steps
Set up React Native
Install Node.js as described on the React Native website. Open a new terminal and check that this prints a version.
> node --versionCreate a project
To use an existing project, open its root folder in VS Code with File > Open Folder…, or drag the folder into VS Code. Otherwise, create one.
Use either of these
-
VS Code extension
Run KXBuild: New Project from the Command Palette and pick the "React Native App" template.
-
Command line
Keep the parent path short, because the dependency folders nest deeply.
> kxbuild project create -t react_native_app -n rnhello -o D:\work
Run doctor
Do this first whenever you open a project for the first time. Doctor checks your React Native setup and prepares the iOS project.
Use either of these
-
VS Code extension
In the title bar of the KXBuild view, open the ··· menu and run Doctor (fix environment).
-
Command line
> kxbuild doctor D:\work\rnhello
After doctor, install the native dependencies in the ios folder. See CocoaPods.
ios> pod installWrite code
Write JS and TypeScript in VS Code as usual, and Metro reloads when you save. KXBuild provides completion and go to definition for the native code under ios/.
Debug
In a second terminal, run npx react-native start in the project folder. Then select your device and press F5. Debug native breakpoints in VS Code and JS breakpoints in the Metro / Hermes debugger. The two work independently.
Release
Build with the Release configuration. The JS is bundled into the app, and the .ipa is written to the ios folder. To upload it to App Store Connect, see Release and App Store submission.
Use either of these
-
VS Code extension
Switch the configuration to Release in the Build configuration node of the KXBuild view, then run KXBuild: Build from the Command Palette.
-
Command line
> kxbuild build .\ios\rnhello.xcworkspace -c Release
Next steps
Build and configure
Debug versus Release, choosing a scheme, target and configuration, overriding build settings, where build products go, when you get an .ipa and when Swift package dependencies resolve.
Release and App Store submission
Build Release with a Distribution certificate to get an .ipa, upload it to App Store Connect with Transporter or Appuploader, then go through TestFlight and App Review. Ad Hoc and enterprise distribution work the same way.
Don't see your framework?
kxbuild is a general-purpose build toolchain, so if your framework produces an Xcode project, KXBuild can build it. The list above covers common cases only. Tell us about your setup.