uni_links,Understanding the Basics of Universal Links

uni_links,Understanding the Basics of Universal Links

Understanding the Basics of Universal Links

uni_links,Understanding the Basics of Universal Links

Universal Links, introduced by Apple at WWDC 2015, are a unique feature of iOS 9 and later versions. This feature allows users to open a HTTPS link directly in your app, providing a seamless experience between the web and the app. To leverage this feature, it’s essential to have a HTTPS-enabled domain and follow a specific configuration process. Let’s dive into the details of setting up Universal Links in your uniapp project.

Step-by-Step Guide to Configuring Universal Links

Before you begin, ensure you have a HTTPS-enabled domain. Here’s a step-by-step guide to configure Universal Links in your uniapp project:

  1. Enable Associated Domains Service
  2. Log in to your Apple Developer account and navigate to the App ID you want to configure. Enable the Associated Domains service. If you haven’t enabled it before, you’ll need to generate a new certificate and repackage your app.

  3. Obtain Required Parameters
  4. Go to the Identifiers section in your Apple Developer account. Find the app you want to configure and click on it. You’ll need the Team ID and Bundle ID for the next steps.

  5. Create apple-app-site-association File
  6. Create a new text file named “apple-app-site-association” (without any file extension). The content of the file should be in JSON format, as shown below:

      {    "applinks": {      "apps": [],      "details": [        {          "appID": "your-app-id",          "paths": ["/path/to/your/app"]        }      ]    }  }  
  7. Deploy apple-app-site-association File
  8. Upload the “apple-app-site-association” file to your cloud server. Ensure that the SSL certificate is correctly configured for your domain.

  9. Configure Associated Domains in manifest.json
  10. In your uniapp project, locate the “manifest.json” file. Add the following line under the “plus” section:

      "Associated Domains": ["your-app-id.development"]  
  11. Paste Universal Link in the App
  12. Open your app and paste the Universal Link in the appropriate permission module. This will allow the app to open the link directly.

  13. Configure Universal Link in WeChat Open Platform
  14. Go to the WeChat Open Platform and configure the Universal Link. Follow the instructions provided by WeChat to complete the setup.

Table: Summary of Steps to Configure Universal Links

Step Description
1 Enable Associated Domains Service
2 Obtain Required Parameters
3 Create apple-app-site-association File
4 Deploy apple-app-site-association File
5 Configure Associated Domains in manifest.json
6 Paste Universal Link in the App
7 Configure Universal Link in WeChat Open Platform

Best Practices for Universal Links

Here are some best practices to ensure a smooth experience with Universal Links:

  • Use HTTPS: Always use HTTPS for your domain to ensure secure communication between the server and the app.
  • Keep apple-app-site-association File Updated: Regularly update the “apple-app-site-association” file with the latest information about your app.
  • Test Universal Links: Test your Universal Links on different devices and iOS versions to ensure they work as expected

google