What is the difference between itms-app:// and https:// App Store link

Viewed 11092

I'm trying to create the link to App Store and I found many ways to do it.

  1. Open App Store page in iTunes Store.

    let url  = URL(string: "itms://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542")
    
  2. Open App Store.

    let url  = URL(string: "https://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542")
    
  3. Open App Store.

    let url  = URL(string: "itms-apps://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542?mt=8")
    

As far as I know, Method #2 and #3 almost produce the same result.

But I curious it should have some difference?.

3 Answers

if you have using this link itms-app:// it will open the app directly in the store.

let url  = URL(string: "itms://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542")

you have using this link https:// it will open links from launching iTunes with Safari.

var iTunesLink = "https://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542"
UIApplication.shared.openURL(URL(string: iTunesLink)!)

First of all itms and itms-apps are defined Apple URL Schemes and they are only linked immediately to their specific app as you said itms will open iTunes Store and itms-apps will open the App Store.(if they exist)

    if #available(iOS 10.0, *) {
        UIApplication.shared.open(url!, options: [:]) { (finished) in
        }
    } else {
        // Fallback on earlier versions
        UIApplication.shared.openURL(url!)
    }

Using https if used with openURL or open will launch the App Store if exist or iOS supported otherwise it will launch Safari.

Option 2 depends on JavaScript. If you load https://itunes.apple.com/th/app/cafe-amazon-smart-pay/id1047593542 in the browser with JavaScript disabled, the App Store won't open.

Related