我已经看到了一些答案,但对它们不满意并得到了一些想法,但不知道如何正确使用它,以便它以正确的方式执行,尽管我认为它应该在应用程序委托(delegate)中使用 didFinishLaunching
,但我想确保在 Live 应用程序中实现它之前没有任何麻烦。
SKStoreReviewController
仅适用于我阅读的 ios 10.3,任何人都可以用 swift 和客观 c 中的一点代码来解释。
更新:
其实我对调用方法requestReview()
很困惑,我需要在哪里调用这个方法呢?在 rootViewController
的 viewDidLoad
或 appDelegate
的 didFinishlaunching
中?
谢谢。
最佳答案
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 - SKStoreReviewController,如何正确使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43177249/