Search code examples
iosstorekit

Determine which button was tapped on system alert


I am presenting SKStoreReviewController.requestReview() and I want to have a boolean in UserDefaults which I would make true in case the user taps on Cancel.

Is there a way to determine if cancel was tapped considering this is a OS alert?


Solution

  • There isn’t a way to access which button was selected. I’m curious why you would you need this functionality? The OS will decide if the user should be shown the alert depending on a few factors including when the user last left a review or canceled.

    Apple Developer Site: https://developer.apple.com/documentation/storekit/skstorereviewcontroller/2851536-requestreview

    Although you should call this method when it makes sense in the user experience flow of your app, the actual display of a rating/review request view is governed by App Store policy. Because this method may or may not present an alert, it's not appropriate to call it in response to a button tap or other user action.