A step-by-step guide to building and running your iOS app in the Xcode Simulator and on a physical iPhone, including selecting schemes, signing, and trusting the developer.
Writing code is only half of iOS development. To know whether your app actually works, you need to run it.
Xcode gives you two main ways to do this: the iOS Simulator, which mimics iPhone and iPad models on your Mac, and a real device connected over USB or Wi-Fi.
The Simulator is fast and convenient for most UI and logic work. A physical device is essential for testing performance, camera, sensors, Bluetooth, and anything that behaves differently on real hardware.
This guide walks through both paths so you can iterate quickly in the Simulator and validate on a real iPhone before you ship.
Launch Xcode and open your existing project, or create a new one with File > New > Project.
For a fresh app, choose the iOS App template, give it a name, pick Swift as the language and SwiftUI or Storyboard for the interface, then save it somewhere convenient.
Xcode will open the project workspace. The left panel is the navigator, the center is your editor, and the right panel shows inspectors.
At the top of the window you will see the scheme and run destination selector, which controls what gets built and where it runs. That selector is the key to everything in this guide.
Near the top-left of the toolbar, click the run destination menu next to your app's scheme name.
You will see a list of available simulators, such as various iPhone and iPad models. Pick one that matches the device you want to test, for example a recent iPhone model.
If the model or iOS version you want is not listed, you can download additional simulator runtimes from Xcode's settings under the Platforms or Components area.
Once a simulator is selected, that destination becomes the target for your next build and run.
Press the Run button (the triangular play icon) in the toolbar, or use the keyboard shortcut Command-R.
Xcode compiles your code, launches the selected simulator, installs the app, and starts it automatically. The first build may take longer while Xcode indexes and compiles everything.
When the app appears in the Simulator window, you can interact with it using your mouse and keyboard. Use the Simulator's Device and Features menus to rotate, simulate location, or trigger other conditions.
To stop the app, press the Stop button (the square icon) in Xcode, or press Command-period.
Connect your iPhone or iPad to your Mac with a cable. The first time, you may be prompted on the device to Trust This Computer; tap Trust and enter your passcode.
In Xcode, the connected device should appear in the run destination menu, usually listed by its name above the simulators.
You will also need to enable Developer Mode on the device if prompted. On recent iOS versions, go to Settings > Privacy & Security > Developer Mode, turn it on, and restart the device.
Select your device as the run destination so Xcode targets the real hardware instead of a simulator.
Running on a real device requires code signing. Select your project in the navigator, choose the app target, and open the Signing & Capabilities tab.
Enable Automatically manage signing and select your team. If you only have a free Apple ID, add it in Xcode's Accounts settings first; a personal team is enough for running on your own device.
Xcode will create or fetch the necessary certificate and provisioning profile for you. If you see a signing error, it usually means you need to pick a team or change the bundle identifier to something unique.
A unique bundle identifier, such as a reverse-domain string like com.yourname.appname, avoids collisions with other apps.
With your device selected and signing configured, press Command-R again. Xcode builds, installs, and launches the app on your iPhone.
The first time you run an app signed with a personal team, iOS may block it as an untrusted developer. To fix this, go to Settings > General > VPN & Device Management on the device.
Find your developer profile, tap it, and choose Trust. Then return to the home screen and tap the app icon to launch it.
After that, the app runs like any other, and subsequent builds from Xcode install over the top without needing the trust step again.
The Simulator is your everyday workhorse. It is fast to launch, easy to reset, and lets you switch between iPhone and iPad models in seconds.
For laying out screens, wiring up navigation, and checking logic, the Simulator is usually all you need, and its quick feedback loop keeps you moving.
Real hardware tells a different and more honest story. The camera, microphone, GPS, accelerometer, Bluetooth, and the Secure Enclave either do not exist or are only approximated in the Simulator.
Performance also differs. The Simulator runs on your Mac's processor, so it can feel faster or slower than an actual phone. Always profile and validate timing-sensitive work on a device before you ship.
Once you have connected a device with a cable at least once and trusted it, Xcode can often run on that device wirelessly on the same network.
In the Devices and Simulators window, you can enable the option to connect to the device over the network for a paired device.
After that, you can unplug the cable and the device may still appear in the run destination menu, letting you build and run without a physical connection.
Wireless runs are convenient for testing while holding the device naturally, though a cable is generally more reliable for the very first setup and for large, frequent installs.
If your device does not appear, check the cable, unlock the device, and confirm you tapped Trust. A quick reconnect often resolves it.
If the build fails with a signing error, revisit Signing & Capabilities, confirm a team is selected, and make sure the bundle identifier is unique.
If the Simulator feels slow, close other heavy apps, and remember the first build is always the slowest while Xcode indexes the project.
Apps installed with a free personal team expire after a short period and must be re-run from Xcode. A paid Apple Developer Program membership removes that limitation and is needed for App Store distribution.
No. A free Apple ID with a personal team lets you run apps on your own device. A paid Apple Developer Program membership is required to distribute via the App Store and removes the short expiration on personal-team builds.
Make sure the device is unlocked, the cable is connected, you tapped Trust This Computer, and Developer Mode is enabled in Settings. Reconnecting the device usually helps.
It covers most UI and logic testing well, but it cannot replicate real hardware features like the camera, sensors, true performance, or Bluetooth. Test on a real device before release.
Apps signed with a personal team must be trusted manually. Go to Settings > General > VPN & Device Management, select your developer profile, and tap Trust.