3

I am sending an universal link to other user through email or SMS. When the user clicks on the link, I want the following to happen:

  1. If the user does not have my app installed, the link should open the App Store and prompt the user to install the app.
  2. If the user does have my app installed, the link should open the app and navigate to a specific screen. I want to be able to get some values from the user after they install the app from the App Store. Is this possible using universal links?

Here is an example of how this might work:

  1. The user clicks on a universal link in an email.
  2. The link opens the App Store and prompts the user to install the app.
  3. The user installs the app.
  4. The app opens and navigates to a screen that displays the values that were passed to the app from the universal link.

sample association file:

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
             "components": [               
               {
                  "/": “/room/*”,
                  "comment": "Matches any URL with a path that starts with /room/.”
               }
             ]
           }
       ]
   },
   "webcredentials": {
      "apps": [ "ABCDE12345.com.example.app" ]
   },

    "appclips": {
        "apps": ["ABCED12345.com.example.MyApp.Clip"]
    }
}

Appdelegate method:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    // Check if the user came from a universal link.
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
      // Get the URL of the universal link.
      let url = userActivity.webpageURL
       
      // Check if the URL is for the profile page.
      if url?.path == "/room" {
         
        // Navigate to the profile page.
        let vc = RoomViewController()
        self.window?.rootViewController = vc
      } 
    }
    // Return true to indicate that the universal link was handled.
    return true
  }

but it's not working am I missing something or the universal link is not supporting the Appstore app installation values passing

could you please suggest?

Reference links: Is it possible to navigate to a certain screen using the universal link in ios using swift

exactly looking for this approach in native iOS

enter image description here

Thank you.

Vignesh
  • 592
  • 6
  • 25
  • Please find this [Link](https://stackoverflow.com/questions/49917994/how-can-i-pass-data-through-the-app-store-to-a-downloaded-app). Hope It would be help you. – ssowri1 Jun 03 '23 at 01:38
  • Sure I will explore it, but I am looking for something native – Vignesh Jun 03 '23 at 05:51

0 Answers0