Asking consumer to charge or evaluation app in iOS – Swift Tutorial – iOSTutorialJunction

Asking consumer to charge or evaluation app in iOS – Swift Tutorial – iOSTutorialJunction


On this publish, we are going to discover use the iOS SDK StoreKit framework to request app retailer rankings. By leveraging SKStoreReviewController, we will immediate customers with a pop-up to charge our iOS app with out requiring them to depart the app. Beforehand, we would have liked to open the App Retailer and ask customers to charge the app there. Let’s dive into use the StoreKit framework to request app retailer rankings seamlessly.

Issues to bear in mind whereas including app ranking pop up utilizing SKStoreReviewController

  1. The app ranking alert may be displayed as much as 3 times inside a 365-day interval.
  2. Keep away from triggering the app ranking alert by means of a button click on, as it might not all the time present the alert.
  3. The app icon is managed by SKStoreReviewController and is retrieved out of your app particulars on the iOS App Retailer.
  4. SKStoreReviewController is obtainable ranging from iOS 10.3 and later variations.

Steps to point out app ranking alert in iOS utilizing SKStoreReviewController

Step 1: Import StoreKit framework

Step 2: Open your swift class, the place you wish to implement this app ranking alert. Create a perform to request evaluation pop up usingSKStoreReviewController class. Beneath is the code for asking app ranking pop up.

import UIKit
import StoreKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        tremendous.viewDidLoad()
        // Do any further setup after loading the view.
       	self.requestAppReview()
    }
    
    func requestAppReview() {
        if #out there(iOS 14.0, *) {
            if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
                SKStoreReviewController.requestReview(in: scene)
            }
        } else {
            SKStoreReviewController.requestReview()
        }
    }
}

Since requestReview is deprecated in IOS 14.0 and onward. So we are going to use, requestReview(in: scene) perform launched after iOS 14.0 and onward. That’s it and we have now carried out app ranking pop up in our iOS app. You will notice a pop up in your app like this (please ignore the app icon because it’s taken from app that’s already on iOS app retailer).



author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
rooshohttps://www.roosho.com
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Latest Articles

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.