Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Last active August 23, 2023 10:18
Show Gist options
  • Select an option

  • Save shawnbot/5527355 to your computer and use it in GitHub Desktop.

Select an option

Save shawnbot/5527355 to your computer and use it in GitHub Desktop.
Testing web pages with Xcode's iOS Simulator

Finding the Simulator

You can test with the iOS Simulator that comes with Xcode. Navigate to the Xcode app in the Finder, right click and select "Show Package Contents":

screen shot 2013-05-06 at 12 04 27 pm

Then navigate to Contents > Applications, and open the shortcut to "iPhone Simulator" (it may be called "iOS Simulator" depending on which version of Xcode you're running):

screen shot 2013-05-06 at 12 05 45 pm

Viewing & Testing

When you're in the simulator, click open Safari, click on the URL bar, and you can paste the testing URL using ^⌘V (Edit > Paste Text), then hit enter.

You can test different devices and orientations using the Hardware menu:

screen shot 2013-05-06 at 12 10 44 pm

Debugging

You can use Safari's inspector to debug web pages running in the simulator. Just open Safari (in OS X) alongside the simulator running Safari in iOS, and go to Develop > iPhone Simulator > [your device/tab]:

screen shot 2013-05-06 at 12 18 48 pm

@brandonzylstra

Copy link
Copy Markdown

The latest version of Xcode does not have the simulator there:
image

@tomByrer

tomByrer commented Mar 3, 2016

Copy link
Copy Markdown

@brandondrew:

  1. Open Xcode
  2. in appbar, right-click over Xcode
  3. Open Dev Tool, Simulator
  4. Change device in Menu:Hardware/Device/iOS ./etc

@stretchkennedy

Copy link
Copy Markdown

You can open the simulator from the normal cmd-e search dialogue now.

@SaraChicaD

Copy link
Copy Markdown

This was very helpful, thank you!

@martingebhardt

martingebhardt commented Jun 2, 2017

Copy link
Copy Markdown

@tomByrer Thank you!

@saiqulhaq

Copy link
Copy Markdown

The simulator app location has changed to /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

@eso32

eso32 commented Dec 1, 2018

Copy link
Copy Markdown

@tomByrer thanks!

@wortwart

Copy link
Copy Markdown

Copying the simulator app to the apps folder did not work but you can create an alias and move it there.

@nnimis

nnimis commented Jul 13, 2020

Copy link
Copy Markdown

In XCode 11.5 the simulator is on /Contents/Developer/Applications/Simulator.app

@contis2908

Copy link
Copy Markdown

On macOs Big Sur I cant find the option Safari>Develop>Iphone Simulator
Is there another way to debug a website on an simulated xcode device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment