Categories: Infrastructure

Debug iOS Safari from your Mac

When we were testing our implementation of Apple Pay on our iPhones, we found a few issues where we needed a proper debugger. This post describes how to set one up, connected to your phone so you can figure out what went wrong.

Setup

On recent versions of iOS (v6 and up), Apple offers a remote debugger for your iPhone, iPod or iPad’s Safari web browser.

Here’s how you set it up

  1. On your iPad, iPhone or iPod, go to Settings > Safari > Advanced and toggle on Web Inspector.
  2. On your Mac, open Safari and go to Safari > Preferences > Advanced then check Show Develop menu in menu bar.
  3. Connect your iOS device to your Mac with the USB cable.
  4. On your Mac, restart Safari.
  5. On your iOS device, open the web site that you want to debug.
  6. On your Mac, open Safari and go to the Develop menu. You will now see the iOS device you connected to your Mac.

NOTE: If you do not have any web page open on your iOS device, you will see a message saying “No Inspectable Applications”.

Connecting the debugger

Once connected to your iOS device from your Mac, you can easily debug your web site just as you would if you were testing a web site locally.

NOTE: The following instructions describe working with an iPhone, but they work just as well with an iPad or iPod.

  1. On your iPhone, open up the website you want to debug; in our case, www.busbud.com
  2. On your Mac, in Safari, go to Develop > iPhone > www.busbud.com. This will open a Safari Web Inspector window on your Mac.
  3. On your Mac’s Safari Web Inspector window, fire up the debugger tab, check off the Breakpoint for All Exceptions.
  4. On your iPhone, interact with your website, and on your Mac’s Safari Web Inspector window, resume script execution and inspect variables until you find the bit of buggy code you were seeking. Then fix it ⚡️.

Happy debugging!

Mike Gradek
Busbud CTO and Co-Founder

Source: Busbud engineering

Mike Gradek

View Comments

Share
Published by
Mike Gradek

Recent Posts

Paris Olympics: budget hacks for an epic summer

The clock is ticking towards the grand opening of the Paris games! From July 26th…

1 week ago

What it’s like to travel from Paris to Brussels by bus

Taking the bus is one of the most affordable and practical ways to travel anywhere…

2 weeks ago

How to see the 2024 Total Solar Eclipse

On April 8th of this year, people in Mexico, US and Canada will have the…

4 weeks ago

6 destinations to spend summer in Europe without spending a fortune

Summer in Europe is in sight — and so are its long, balmy days and…

1 month ago

NYC to Montreal: how to travel for $108 & see 4 trending towns along the way!

Visit two countries across six cities for $108? Sign us up! Journey from the Big…

1 month ago

Are shuttle services the future of public transportation?

For most people, public transport means buses and trains. But a different type of public…

2 months ago