Open AppStore through button

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

    Since other answers didn't work for me (Swift, Xcode 6.1.1) here I post my solution:

    var url  = NSURL(string: "itms://itunes.apple.com/de/app/x-gift/id839686104?mt=8&uo=4")
    
    if UIApplication.sharedApplication().canOpenURL(url!) {
        UIApplication.sharedApplication().openURL(url!)
    }
    

提交回复
热议问题