How to Build an iOS App with Next.js in 2025
Turn your Next.js web app into a native iOS application using Capacitor. This step-by-step guide covers everything from initial setup to publishing on the App Store.
📋 Prerequisites
- Next.js project ready
- macOS computer (required for iOS development)
- Xcode installed from Mac App Store
- Apple Developer account ($99/year)
🎯 What You'll Learn
- Configure Next.js for iOS development
- Set up Capacitor for iOS
- Build and run your app in iOS Simulator
- Add iOS-specific features
- Prepare for App Store submission
Step-by-Step Guide
Before You Start
Most web developers waste days fighting provisioning profiles, signing errors, and iOS build failures.
This guide shows the cleanest, modern workflow that actually works — even if you’ve never shipped an iOS app before.
This is the exact setup used to publish Sproutly AI and Lasting Habits to the App Store.
Install Xcode and Command Line Tools
Download Xcode from the Mac App Store (it's ~10GB). After installation, install command-line tools.
# Verify installation
xcode-select -p
# Install command line tools if needed
xcode-select --installXcode is required for iOS development and works only on macOS.
Configure Next.js for Static Export
iOS apps need static files. Configure Next.js to export a static version for Capacitor.
const nextConfig = {
...(process.env.IS_NATIVE && {
output: "export",
images: { unoptimized: true },
})
};
export default nextConfig;Update package.json scripts
Add scripts to build and open the iOS project easily.
"mobile": "cross-env IS_NATIVE=true npm run build && cross-env IS_NATIVE=true npx cap sync",
"mobile:dev": "cross-env IS_NATIVE=true npm run build && cross-env IS_NATIVE=true npx cap sync && npm run dev"Install and Initialize Capacitor
Add Capacitor to your project.
npm install @capacitor/core @capacitor/cli
npx cap initEnter your app name and bundle ID (e.g., com.yourcompany.app).
Update Capacitor Config
Configure Capacitor to use your build directory.
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.yourcompany.app',
appName: 'Your App Name',
webDir: 'out',
};
export default config;Add iOS Platform
Create the native iOS project folder.
npx cap add iosBuild and Sync
Build your Next.js app and sync it with the iOS project.
npm run build
npx cap sync iosRun sync whenever you change your web code.
Open in Xcode
Open your project in Xcode to configure signing.
npx cap open iosConfigure Signing for Real Devices & App Store
2. Select the App target
3. Go to Signing & Capabilities tab
4. Enable Automatically manage signing
5. Select your development team
Run on iOS Simulator
In Xcode: select a simulator (e.g., iPhone 15 Pro), then press Cmd+R.
First run is slow, subsequent runs are instant.
Test on a Real Device
1. Connect your iPhone via USB
2. Trust the computer
3. Select your device and Run
On device: Settings → General → VPN & Device Management → Trust Certificate
💡 Common Issues & Fixes
• Build errors after sync? Run: npx cap sync ios + build clean
• App stuck on splash screen? Ensure static export is enabled
• Signing errors? Re-enable “Automatically manage signing”
🚀 Bonus: Production-Ready Template
Want to skip setup and start from a working iOS app?
See what's included in NextNative →
Related Tutorials
How to Convert Your Next.js App to iOS & Android
Learn how to convert your Next.js web application into fully functional iOS and Android mobile apps using Capacitor.
How to Deploy Your Next.js App to the App Store
Learn how to prepare, build, and submit your Next.js mobile app to the Apple App Store. This guide covers everything from app icons to App Store Connect configuration.
Compare Mobile Frameworks
Still deciding on your tech stack? Check out these comparisons
📚 Ship mobile apps faster
Explore detailed documentation to see features and shortcuts NextNative gives you to ship mobile apps faster.
📖 Full Documentation
Complete guides, API references, and best practices for building mobile apps with NextNative.
🚀 Quick Start Guide
Get your app up and running in just 5 minutes with our quick start tutorial.
🔔 Push Notifications
Learn how to set up and customize push notifications for your mobile app.
💰 In-App Purchases
Implement monetization with in-app purchases using RevenueCat integration.