3

I have a menu-button in my app. If user clicks this button he sees UIAlertView which include app-link to the App Store.

Here is the code:

@IBAction func navButton(_ sender: AnyObject) {

let alertController = UIAlertController(title: "Menu", message: "Thanks for using our app!", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Rate Us on the App Store", style: .default, handler: { (action: UIAlertAction) in
print("Send user to the App Store App Page")

let url  = URL(string: "itms-apps://itunes.apple.com/app/id")
     if UIApplication.shared.canOpenURL(url!) == true  {
     UIApplication.shared.openURL(url!)
}  
}))

I know that in iOS 10.3 there was an opportunity to set a rating right in the application. What should I change, so that when a user clicks on a link in UIAlertView, he could set a rating right in the application?

I found some information on Apple Developer website (https://developer.apple.com/reference/storekit/skstorereviewcontroller) but I don't know how to do this in my app.

1 Answer 1

6

It's one class function based on looking at the docs.

SKStore​Review​Controller.requestReview()

It also states you shouldn't call this function dependent on a user pressing a button or any other type of action because it is not guaranteed to be called. It would be a bad user experience if you indicate they are about to be shown a review modal and then nothing appears.

If you use this new option in your app it seems the best option is to just place it somewhere that won't interrupt any important actions being conducted by the user and let the framework do the work.

You can use criteria the user isn't aware of to choose when to call the function, i.e. launched the app x amount of times, used x number of days in a row, etc.

Edit: alternative

If you want to keep more control over the ability to request reviews you can continue the old way and append the following to your store URL to bring them directly to the review page.

action=write-review

guard let url = URL(string: "appstoreURLString&action=write-review") else { return }
UIApplication.shared.open(url, options: [:], completionHandler: nil)
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much! Sorry for late reply.
An additional detail... make sure to import StoreKit :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.