Rodrigo Ruiz
Rodrigo Ruiz

Reputation: 4355

Know when SKStoreReviewController gets dismissed

After calling SKStoreReviewController.requestReview(), the use will be presented a popup.

When the user taps on any of the options, how do I know the popup was dismissed?

Upvotes: 3

Views: 1666

Answers (1)

CodeBender
CodeBender

Reputation: 36620

It's not possible to find out anything about the SKStoreReviewController directly.

The following post explains more about how the view is presented & may help you understand why.

However, I don't like that answer so I tested a variation of your comment and was able to determine exactly when the screen was dismissed.

The following is a very bare bones app that illustrates this:

import UIKit
import StoreKit

class ViewController: UIViewController {
    @IBOutlet weak var testView: TestView!

    override func viewDidLoad() {
        super.viewDidLoad()

        testView.isUserInteractionEnabled = false
    }

    @IBAction func submit(_ sender: UIButton) {
        testView.isUserInteractionEnabled = true
        SKStoreReviewController.requestReview()
    }
}

class TestView: UIView {
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)

        print("touch")
    }
}

What is going on here is that I have a view over my main screen that can only be interacted with after the prompt is displayed. You should of course clean it up such that it stops receiving input after the first success, but this does notify me of user interaction with the app after the request is dismissed.

Upvotes: 2

Related Questions