編輯:現在你添加更多的代碼,讓我告訴你我是如何實現你想實現。
CODE:
func showRateMe() {
let alert = UIAlertController(title: "Would you like to rate the App?", message: "We hope you enjoy the App !", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Rate App now !", style: UIAlertActionStyle.Default, handler: { alertAction in
UIApplication.sharedApplication().openURL(NSURL(string : "https://itunes.apple.com/us/app/name/id")!)
alert.dismissViewControllerAnimated(true, completion: nil)
}))
alert.addAction(UIAlertAction(title: "Later!", style: UIAlertActionStyle.Default, handler: { alertAction in
alert.dismissViewControllerAnimated(true, completion: nil)
}))
self.presentViewController(alert, animated: true, completion: nil)
alert.addAction(UIAlertAction(title: "NO !", style: UIAlertActionStyle.Default, handler: { alertAction in
NSUserDefaults.standardUserDefaults().setBool(true, forKey: "neverRate")
alert.dismissViewControllerAnimated(true, completion: nil)
}))
}
SOLUTION(我認爲):
我在我的代碼中使用:"https://itunes.apple.com/us/app/name/id"
你在你的使用:"itms://itunes.apple.com/de/app/toothache-be-the-monster/id1033405285?mt=8&uo=4"
此致應該:"https://itunes.apple.com/de/app/toothache-be-the-monster/id1033405285?mt=8&uo=4"
施加到這個問題以前版本的舊答案:
如果我沒有記錯的話,這是你需要做什麼:
1)創建取消按鈕與IBAction。
2)IBAction爲做到這一點:
self.dismissViewController()
3)完成。
這就是我如何「執行取消按鈕」,你在你的問題中寫道。
取消按鈕應該做什麼? – dasdom
我們可以看到您打開應用商店的代碼 – 123FLO321
@ 123FLO321我已添加代碼。 –