iosswiftstorekitskstorereviewcontroller

Use of unresolved identifier 'SKStoreReviewController' but imported StoreKit already


I've already imported StoreKit into the ViewController where I want users to trigger the actions so that they can rate my app, however I keep getting the below error despite the number of times I've cleaned and built my app etc. so I think its likely something I did wrong

This is my code:

    func promptUserToRateApp() {

     if #available(iOS 10.3, *) {
        SKStoreReviewController.requestReview()
     } else {
        // Fallback on earlier versions
     }
   }

and this is the error im getting: enter image description here


Solution

  • Its because I'm on Xcode 8.2.1 and IOS 10.2 where SKStoreReviewController is not available.

    For a quick way to install and switch Xcode versions, refer to the below link:

    https://littlebitesofcocoa.com/314-installing-and-switching-xcode-versions-from-the-command-line