Potato Logo Half Baked City Potato Logo

Testing on iPhones

For those who went through the Getting Started With WebXR Series, you may be wondering how to test things. This tutorial will go through my method of testing things on iPhones

Step 1

First thing is get yourself a self signed certificate. I'll let you figure it out

Unfortunately we need to setup an https server because the Device Orientation API requires a secure context and we have no way of forwarding the iPhone's localhost to the computer's 😢

Hopefully you figured out how to get some self signed ssl certs, so now let's build a secure web server. I like Python3, so we're going to use that. If you don't have Python3, then figure it out

Once you have Python3, create a little python script file called run_https_server.py with the following lines of code

Replace the paths to the keyfile and certfile with the path to your files

Now when you run this script with python3 run_https_server.py you'll have an https server running on port 4443

To connect to your webserver from your iPhone you'll need to make sure your computer and iPhone are on the same network. Then find out the ip address of your computer with ifconfig. After you find out the ip address you can enter https://YOUR_IP_ADDRESS:4443 in the url of Safari and then reach your web server

Step 2

Now we'll figure out how to debug things

  1. Connect your iPhone to the computer
  2. On your phone, open your webpage in Safari
  3. On your computer, open up Safari Technology Preview
  4. Enable the Develop Menu if you haven't already
  5. Go to Develop->Your iPhone->The web page you're running

Great, now you're able to easily see logs and debug things!

I do apologize for not being much help in making self signed certificates or installing Python3, but there's a lot of ways to do things depending on your computer so I wouldn't be of much help even if I tried

Feeling generous/want to support me in writing tutorials? Then buy me a coffee, which I'll probably use for boba or almonds (raw and unsalted you heathens) because I don't like coffee

Comment

Please Wait...

Log in/Sign up to comment

Server error, please try again later

...