Open AppStore through button

前端 未结 15 769
逝去的感伤
逝去的感伤 2020-12-12 22:18

Could you guys help me to translate the following code into Swift?

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@\"itms://itunes.apple.com         


        
15条回答
  •  不思量自难忘°
    2020-12-12 22:26

    For me didn't worked one of this answers. (Swift 4) The app always opened the iTunes Store not the AppStore.

    I had to change the url to "http://appstore.com/%Appname%" as described at this apple Q&A: https://developer.apple.com/library/archive/qa/qa1633/_index.html

    for example like this

    private let APPSTORE_URL = "https://appstore.com/keynote"
    UIApplication.shared.openURL(URL(string: self.APPSTORE_URL)!)
    

    (remove spaces from the app-name)

提交回复
热议问题