What You Need to Know About App URL Scheme

I’ve recently been using Beijing Yitongxing to scan QR codes to ride buses and subways. To be more efficient, I started researching whether I could pop up the subway or bus code with one click. After all, finding the App, launching it, and then switching to the corresponding ride code is quite cumbersome.

The core of this feature—one click to open a specific page in an App—is essentially a URL Scheme. The key is whether I can obtain that information.

To summarize, I could only manage to open the Yitongxing App with RuubyPay://, but I couldn’t get to the specific subway or bus code page. This is because I couldn’t find the relevant SDK or didn’t guess the correct page URL. Although I didn’t fully solve the problem, I did figure out the general method for finding the URL Scheme of a specific App, which could be useful in the future.

Basic Methods

  1. Google/GitHub Search

    The first step is always to search widely since many others may have already found it, like weixin://scanqrcode for WeChat’s QR code scanner.

  2. Official Documentation

    Some well-documented apps provide detailed information about URL Schemes, such as Surge or Things. For apps like WeChat or Meituan, however, there isn’t systematic documentation, so users rely on community discoveries, which is less ideal.

  3. Checking the info.plist with tools like iMazing, or directly viewing the app’s contents in Finder for Mac apps.

    Search for the CFBundleURLSchemes keyword in info.plist; the array values will be the URL Schemes.

https://static.1991421.cn/2022/2022-10-16-211355.jpeg

  1. Many apps have corresponding web versions with links that redirect to the app. These redirect links are URL Schemes, which can be captured from the webpage. For example, Tencent Meeting’s one-click join meeting link or China Merchants Bank’s promotional pages. With simple debugging, the URL Scheme can be identified.

    https://static.1991421.cn/2022/2022-10-16-214238.jpeg

Notes

  1. Schemes are case-sensitive. For example, RuubyPay:// can open Yitongxing, but rubbypay:// will return an incorrect address error.
  2. Depending on the developer, an app can support multiple Schemes or none.
  3. Checking info.plist only helps launch the app, but not for specific page paths, as these are not predefined in the file and are implemented in the code. Without an SDK or web code to extract from or guessing the correct path, you can only open the app but not trigger specific actions.
  4. The Apple ecosystem supports Schemes across iPads, iPhones, and Macs.

Particular Use Case - Check if an App is Installed

In addition to quickly launching an app or specific features, URL Schemes can also be used to check whether an app is installed.

Usage:

  1. Declare the apps to be checked in info.plist.

    Note that the limit for URL Scheme queries is 50.

1
2
3
4
5
<key>LSApplicationQueriesSchemes</key>
<array>
<string>myapp1</string>
<string>myapp2</string>
</array>
  1. Call in the code and determine if the app is installed based on the return value of true/false.
1
UIApplication.shared.canOpenURL(URL(string: "myapp1://test")!)

Side Note:

I learned about this technique when Taio’s developer used it to check if users had installed tools like Surge, which led to some backlash from users. While the action was controversial, the technology itself is neutral, and it’s worth knowing. For more discussion, see the Taio controversy on V2EX.

Docs