Launching App Store from App in Swift Launching App Store from App in Swift swift swift

Launching App Store from App in Swift


You have too many protocols in your URL. Get rid of https: so the URL reads

itms-apps://itunes.apple.com/app/bars/id706081574


Just by following older answers I couldn't make it work, so here I post my complete solution:

if let url  = NSURL(string: "itms-apps://itunes.apple.com/app/id1234567890"),    UIApplication.shared.canOpenURL(url) {      UIApplication.shared.openURL(url)    }}


Use just the short "itms://".

For Swift 3 this is the snippet:

UIApplication.shared.openURL(URL(string: "itms://itunes.apple.com/app/id" + appStoreAppID)!)

I hope this helps someone.

Cheers.

P.S. @Eric Aya was ahead of the time :)