1

I would like to redirect to the app-store to a specific app, using its ID upon receiving a button tap. I have tried all the answers here on stack overview however none worked for me, they are most likely outdated such as these: Open AppStore through button, Launching App Store from App in Swift, How to link to apps on the app store

I tried the following URLs, however I get false via UIApplication.shared.canOpenURL(:_):

"itms-apps://apple.com/app/{appId}"

"itms-apps://itunes.apple.com/developer/{appId}"

"itms-apps://apps.apple.com/cz/app/{developer}/{appId}"

How to currently go about redirecting to App-Store? Can this still be done via URL, or do we have to use the StoreKit exclusively?

Thanks in advance

Ctibor Šebák
  • 133
  • 1
  • 14
  • Added thread links – Ctibor Šebák Dec 14 '21 at 10:23
  • Is there a particular reason you want to open the App Store? Normally using [`SKStoreProductViewController`](https://developer.apple.com/documentation/storekit/skstoreproductviewcontroller) Gives a better user experience as they don't need to leave your app. – Paulw11 Dec 14 '21 at 10:39
  • They are all wrong. An App Store link doesn't even starts with the itms-apps protocol. – El Tomato Dec 14 '21 at 10:54
  • Take a good look at one of the solutions posted at Open AppStore through button. – El Tomato Dec 14 '21 at 10:55
  • Does this answer your question? [Open AppStore through button](https://stackoverflow.com/questions/25882936/open-appstore-through-button) – El Tomato Dec 14 '21 at 10:56
  • I ended up using the `SKStoreProductViewController`, I was really interested if there is any way to open AppStore directly, just out of curiosity – Ctibor Šebák Dec 14 '21 at 13:36

1 Answers1

-1
if let url  = URL(string: "itms-apps://apple.com/app/id\(appid)"),
   UIApplication.shared.canOpenURL(url) {
   UIApplication.shared.openURL(url)
}
Shabnam Siddiqui
  • 579
  • 4
  • 13