Beginner45 minutesUpdated October 2025

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

1

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.

2

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 --install
πŸ’‘

Xcode is required for iOS development and works only on macOS.

3

Configure Next.js for Static Export

iOS apps need static files. Configure Next.js to export a static version for Capacitor.

next.config.ts
const nextConfig = {
  ...(process.env.IS_NATIVE && {
    output: "export",
    images: { unoptimized: true },
  })
};

export default nextConfig;
4

Update package.json scripts

Add scripts to build and open the iOS project easily.

package.json
"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"
5

Install and Initialize Capacitor

Add Capacitor to your project.

npm install @capacitor/core @capacitor/cli
npx cap init
πŸ’‘

Enter your app name and bundle ID (e.g., com.yourcompany.app).

6

Update Capacitor Config

Configure Capacitor to use your build directory.

capacitor.config.ts
import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.yourcompany.app',
  appName: 'Your App Name',
  webDir: 'out',
};

export default config;
7

Add iOS Platform

Create the native iOS project folder.

npx cap add ios
8

Build and Sync

Build your Next.js app and sync it with the iOS project.

npm run build
npx cap sync ios
πŸ’‘

Run sync whenever you change your web code.

9

Open in Xcode

Open your project in Xcode to configure signing.

npx cap open ios
10

Configure Signing for Real Devices & App Store

1. Select your project in the left sidebar
2. Select the App target
3. Go to Signing & Capabilities tab
4. Enable Automatically manage signing
5. Select your development team

πŸ’‘

You need an Apple Developer account to sign apps.

11

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.

12

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

13

πŸ’‘ 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”

14

πŸš€ Bonus: Production-Ready Template

Want to skip setup and start from a working iOS app?

See what's included in NextNative β†’

πŸš€

Ready to Ship Faster?

Get Next.js + Capacitor with auth, in-app purchases, push notifications, database, and 7 template apps. Everything you need to launch.

$125 Β· Unlimited apps

Lifetime updates3 months supportTeam license

Related Tutorials

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.