Is it possible to determine if the SKStore Review Controller has been submitted.

I intend to either display the SKStore Review Controller (if applicable) or display my own feedback controller and redirect the user to the App Store. By doing this, I can not pay attention to the user more than once.

After reading Apple, which lacks documentation on the SKStore Review Controller ( https://developer.apple.com/reference/storekit/skstorereviewcontroller ), there seems to be no way to determine if the SKStore Review Controller is currently submitted or has been submitted before .

I understand that I could store the display frequency in NSUserDefaults, but I would prefer not to.

+5
source share
2 answers

This is how I discovered that it was introduced.

private static func checkIfShownSKStoreReviewController(_ iteration: Int, originalWindowCount: Int) { let windows = UIApplication.shared.windows if windows.count > originalWindowCount { let window = windows[1] if window.className == "UITextEffectsWindow" || window.className == "UIRemoteKeyboardWindow" { print("Shown SKVC iteration: \(iteration)") //Do logic stuff like saving to your database return } } if iteration > 2000 { print("checkIfShownSKStoreReviewController: timeout, bailing \(iteration)") return } runThisAfterDelay(seconds: 0.02, after: { checkIfShownSKStoreReviewController(iteration + 1, originalWindowCount: originalWindowCount) }) } private static func runThisAfterDelay(seconds seconds: Double, after: () -> ()) { let time = dispatch_time(DISPATCH_TIME_NOW, Int64(seconds * Double(NSEC_PER_SEC))) dispatch_after(time, dispatch_get_main_queue(), after) } static func showReview() { print("Showing AppStore Review") if #available(iOS 10.3, *) { SKStoreReviewController.requestReview() checkIfShownSKStoreReviewController(0, originalWindowCount: UIApplication.shared.windows.count) } } 
0
source

Actually, it depends on the Hierarchy that you have. If you use one navigationController

 for (vc in self.navigationController.viewControllers) { if (vc isKindOfClass(SKStoreโ€‹Reviewโ€‹Controller)){ //Means it is present } } 
-3
source

Source: https://habr.com/ru/post/1266449/


All Articles