Today we are going to learn about Sk Store Review Controller.
Sk Store Review Controller is Apple way to request review and rating inside iOS app.
Usually, we use a custom UIView with star images in the app then ratings are recorded in the backend. However, when it comes to app store review, the user generally says “Not now” option because the user wants to come out from the current app’s screen to Apple App store page.
We miss the feedback because of this behaviour.
Implementation
Step – 1:
Create a class for SKStoreReviewController related checks, imports and methods.
import StoreKit
class Review {
}
Step – 2:
My logic for showing the review view is based on the number of app launches done by a given user. The number of launches will be store in NSUserDefaults.
let launchCount = “noOfLaunches” // userdefault key to store the number of launching
Step – 3:
To decide whether to show the review view.
func isReviewViewDisplay(minLaunchCount:Int) -> Bool {
let launchcount = UserDefaults.standard.integer(forKey: launchCount)
if launchcount
>= minLaunchCount {
return true
} else {
UserDefaults.standard.set((
+ 1), forKey: launchCount)launchcount
}
return false
}
Step – 4:
To call the ‘showReview’ method from any view controller of the app.
func showReview(afterMinLaunchCount:Int){
if(self.isReviewViewDisplay
(minLaunchCount: afterMiniLaunchCount)){
SKStoreReviewController.requestReview()
}
}
Step – 5 :
Now you can call “showReview” like this:
if #available(iOS 10.3, *) {
Review().showReview(afterMinLaunchCount: 2)
}else{
}
Minimum number of launches is the int value we set to the number of launch counts.
In conclusion, we have learned about Sk Store Review Controller
Lastly, please share your queries and thoughts below.
For more blogs please click here