Build Cordova iOS Apps on Windows: platforms/ios to .ipa
Add the iOS platform, then build the project in platforms/ios on Windows.
Last updated
To build Cordova iOS apps on Windows, run cordova platform add ios as usual. KXBuild builds the platforms/ios project it creates like any Xcode project, installs it on your iPhone over USB for debugging, and a Release build writes an .ipa under platforms/ios. cordova commands and plugins work as usual. New projects manage dependencies with Swift packages, and you run pod install only when a plugin brings CocoaPods dependencies.
How do I create a Cordova project and add the iOS platform on Windows?
1. Create a Cordova project and add the iOS platform
For an existing project, add the iOS platform in the project folder. Otherwise, create one. Install Cordova with npm, create the project, then add the iOS platform from inside the project folder. The Xcode project is generated under platforms/ios.
> npm install -g cordova> cordova create MyApp com.example.myapp MyApp> cd MyApp> cordova platform add iosThen open platforms/ios in VS Code with File > Open Folder…, or drag the whole Cordova project into VS Code.
2. Run doctor
Doctor checks your build environment and prepares the iOS project.
In the title bar of the KXBuild view, open the ··· menu and run Doctor (fix environment).
> kxbuild doctor .\platforms\ios\App.xcworkspaceBy default the project manages dependencies with Swift packages and doesn't need CocoaPods. If a plugin you add has CocoaPods dependencies, a Podfile appears in platforms/ios. Cordova doesn't install those pods on Windows, so run pod install once in platforms/ios, and again whenever you add or remove such a plugin. See CocoaPods.
platforms\ios> pod installHow do I debug Cordova web and native code on an iPhone?
3. Write code
Keep writing your web code under www/, and run cordova prepare ios after changes to sync it to the iOS project. Native plugin code gets completion and go to definition in VS Code.
4. Debug
Select it in the KXBuild view and press F5. Debug native plugin code with breakpoints in VS Code.
Build, install and launch the app on the phone:
> kxbuild run .\platforms\ios\App.xcworkspaceIn a project with a dev server configured (see below), the app reads www/ straight from the computer over the USB cable, so web changes need no rebuild.
Before you connect a phone for the first time, install and open Apple Devices from the Microsoft Store to get the USB driver on Windows. On iOS 16 and later, turn on Developer Mode in Settings > Privacy & Security and let the phone restart. See connect an iPhone to Windows for the full steps.
How do I build a Cordova iOS .ipa on Windows for the App Store?
5. Release
Build with the Release configuration to get an .ipa under platforms/ios. To upload it to App Store Connect, see publish to the App Store from Windows.
Run KXBuild: Build for App Store (.ipa) from the Command Palette or the project's context menu.
> kxbuild build .\platforms\ios\App.xcworkspace -c Release --export app-storeAn App Store .ipa must be signed with an Apple Distribution certificate. Put your own .p12 certificate and .mobileprovision profile in a keychain/ folder and every build signs automatically; see sign iOS apps on Windows. Upload with kxstore (kxstore build upload, on Windows, Linux or macOS), then handle TestFlight and review on App Store Connect. That way you build Cordova iOS apps on Windows, debug them on a real iPhone and submit them from one computer.
How do I get changes under www onto the phone?
Two ways. By default, run cordova prepare ios in the project folder, then press F5 or run kxbuild run to rebuild and install. To skip the rebuild, configure a dev server once: with kxbuild project settings apply, add KXBUILD_DEV_SERVER_PORTS=8000, KXBUILD_DEV_SERVER_COMMAND=python -m http.server 8000 --bind 127.0.0.1 --directory platforms/ios/www and KXBUILD_DEV_SERVER_DIR=$(SRCROOT)/../.. to the Debug configuration of the platforms/ios project, and in config.xml set content src to http://127.0.0.1:8000/index.html plus <allow-navigation href="http://127.0.0.1:*/*" />. From then on F5 or kxbuild run starts that server and the app reads the pages from the computer over the cable; after a web change, run cordova prepare ios and reopen the app. Set content src back to index.html before you release. If you added or removed a plugin with CocoaPods dependencies, run pod install in platforms/ios again too.
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 kxstore (or Transporter on a Mac), 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.