Open AppStore through button

前端 未结 15 771
逝去的感伤
逝去的感伤 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:31

    For the new AppStore, simply open your app's link on AppStore and replace the https scheme to itms-apps scheme. Example on Swift 4:

    if let url = URL(string: "itms-apps://itunes.apple.com/us/app/my-app/id12345678?ls=1&mt=8") {
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    }
    

    You can find your app's link on the App Information page.

提交回复
热议问题