36

Quick way to open a Custom URL Scheme in iOS Simulator

 3 years ago
source link: https://sarunw.com/posts/quick-way-to-open-custom-url-scheme-in-ios-simulator/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Quick way to open a Custom URL Scheme in iOS Simulator


Table of Contents

In the past, the way I test a custom URL scheme is to go to Safari and type in any of my custom URLs in the address bar.

Testing a custom URL scheme with Safari Testing a custom URL scheme with Safari

This method works, but it is a bit cumbersome. Safari doesn't remember the last custom URL, that's mean you have to type it again and again. And going back and forth between your app and Safari makes things worst.

You can easily support sarunw.com by checking out this sponsor.

essential-dev-image.png Sponsor sarunw.com and reach thousands of iOS developers.

A better alternative

xcrun is a tool to run any tool inside Xcode from the command line. The tool for this job is simctl, which help you manage simulators.

To open a custom URL scheme (or any website) in a simulator.

  1. Run your app in the Simulator.
  2. Open Terminal.app (located in /Applications/Utilities)
  3. Enter the following command and hit ⏎ Return.
xcrun simctl openurl booted <url>

Example

xcrun simctl openurl booted acme://test

This will simulate what we used to do in Safari, but a lot easier and faster.

Testing a custom URL scheme with simctl Testing a custom URL scheme with simctl


You may also like

What do @main, @UIApplicationMain, and @NSApplicationMain mean

When you start a new project, you would see either of these attributes in an AppDelegate file. Let's find out its functionality.

Development
4 Xcode shortcuts to boost your productivity for SwiftUI

Leaning tips and tricks about the tool will help you down the road. Today, I will show you 4 Xcode shortcuts that I find helpful when dealing with SwiftUI.

Development
Spell checking in Xcode

Did you know that you have an option to enable spell checking in Xcode?

Development

Read more article about Simulator, Development,

or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron

Buy me a coffee

Tweet

Share

Previous
How to renew an expired certificate with Fastlane Match

Fastlane Match saves us a lot of time managing certificates and provisioning profiles, but there is one thing that we have to do it manually. That is a renewal expired certificate. Luckily, we have to do it once a year. Let's learn how to do it.

Next
Move your view around with Drag Gesture in SwiftUI

SwiftUI's UIPanGestureRecognizer equivalent.

← Home


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK