First I don't know how to get the link before I submit my app, and if the link is for each country app store or is it universal?
Also I don't know if the way to do it is just by putting the link there like:
@IBAction func rate(sender: AnyObject) { UIApplication.sharedApplication().openURL(NSURL(string : "webLinkHere")!) }
Or should I use another way to do this?
Thanks
swift in your assistant editor. You can do this by holding Option on your keyboard and clicking the ViewController. swift file in your Project Navigator. Now click on the button, hold CTRL and then drag it to your Swift file.
Go to App Information section (it should automatically take you there) At the bottom of that page, there is a blue link that says View on App Store . Click it and it will open to a blank page. Copy what is in the URL bar at the top of the page and that's your app reviews link.
Try This, change appId in your method by your App ID
Swift 5
import StoreKit func rateApp() { if #available(iOS 10.3, *) { SKStoreReviewController.requestReview() } else if let url = URL(string: "itms-apps://itunes.apple.com/app/" + "appId") { if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(url) } } }
Swift 3 \ 4
func rateApp() { guard let url = URL(string: "itms-apps://itunes.apple.com/app/" + "appId") else { return } if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(url) } }
id959379869 This is the id when you go on your Itune page of your app
Example : https://itunes.apple.com/fr/app/hipster-moustache/id959379869?mt=8
How get the ID :
This is working the best for me. Directs the user straight to the 'Write A Review' composer of the application.
Swift 3.1 (Support for iOS10 and below)
Introduces new action=write-review
let appID = "959379869" if let checkURL = URL(string: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=\(appID)&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8") { open(url: checkURL) } else { print("invalid url") } ... func open(url: URL) { if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: { (success) in print("Open \(url): \(success)") }) } else if UIApplication.shared.openURL(url) { print("Open \(url)") } }
Tested and works on Swift 2.2
let appID = "959379869" // Your AppID if let checkURL = NSURL(string: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=\(appID)&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8") { if UIApplication.sharedApplication().openURL(checkURL) { print("url successfully opened") } } else { print("invalid url") }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With