-->

SKStoreProductViewController rate disabled on iOS

2020-08-09 08:53发布

问题:

So I noticed that Apple changed SKStoreProductViewController, disabling the "Write a Review" button. Is there any workaround or fix for this issue?

回答1:

SKStoreProductViewController doesn't support the 'Write a review' option anymore. Why? I really don't know. It did in iOS6.

A work around could be opening the app store with a 'itms-app://'-link.

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {

    NSString *appURL = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/%@/app/id%@",
                        [[NSLocale preferredLanguages] objectAtIndex:0],
                        @"YOUR_APP_ID"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appURL]];

} else {
  // your current StoreKit code    
}


回答2:

Now after iOS 10.3+

The SKStoreReviewController allows users to rate an app directly from within the app through a dialog box. The only downsite is that you can only request StoreKit to display the dialog, but can't be sure if it will.

import StoreKit

func requestToRate() {
   SKStoreReviewController.requestReview()
}

https://stackoverflow.com/a/45793805/905517