ios - SKStore​Review​Controller,如何正确使用?

标签 ios objective-c iphone ios10.3 skstorereviewcontroller

我已经看到了一些答案,但对它们不满意并得到了一些想法,但不知道如何正确使用它,以便它以正确的方式执行,尽管我认为它应该在应用程序委托(delegate)中使用 didFinishLaunching,但我想确保在 Live 应用程序中实现它之前没有任何麻烦。 SKStore​Review​Controller 仅适用于我阅读的 ios 10.3,任何人都可以用 swift 和客观 c 中的一点代码来解释。

更新:

其实我对调用方法request​Review()很困惑,我需要在哪里调用这个方法呢?在 rootViewControllerviewDidLoadappDelegatedidFinishlaunching 中?

谢谢。

最佳答案

SKStoreReviewController 适用于 iOS 10.3 及更高版本。

根据 APPLE 的文件:

You can ask users to rate or review your app while they're using it, without sending them to the App Store.You determine the points in the user experience at which it makes sense to call the API and the system takes care of the rest.

为了在应用内显示评分/评论,您必须添加 StoreKit框架。

请找到两种语言的示例代码:

Objective-C :

#import <StoreKit/StoreKit.h>

- (void)DisplayReviewController {
    if([SKStoreReviewController class]){
       [SKStoreReviewController requestReview] ;
    }
}

从 xCode 9 开始,您可以这样做:

#import <StoreKit/StoreKit.h>

- (void)DisplayReviewController {
    if (@available(iOS 10.3, *)) {
        [SKStoreReviewController requestReview];
    }
}

swift :

import StoreKit

func DisplayReviewController {
    if #available( iOS 10.3,*){
        SKStoreReviewController.requestReview()
    }
}

更新:Ask for a rating only after the user has demonstrated engagement with your app

关于ios - SKStore​Review​Controller,如何正确使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43177249/

相关文章:

ios - 无法从 iOS 应用程序将超过 30 秒的视频上传到 Facebook

ios - 用户终止应用程序时的 iBeacon 通知(通过在任务 View 中向上滑动)

iphone - 删除了所有证书/ key ,现在无法将推送通知推送到部署到应用商店的应用

ios - instantiateInitialViewController 和 instantiateViewControllerWithIdentifier :? 有什么区别

iphone - 使用接近传感器而不关闭屏幕

ios - 如何在 UIAlertController 中设置两个 UITextField 之间的距离?

ios - 在不缓存的情况下在 Swift 中下载文件

ios - nsurlconnection 在以下情况下不返回错误

iphone - xcode加载 View

iOS 有边框按钮点击时的行为