ReviewKit
示例
要运行示例项目,请克隆仓库,然后从 Example 目录首先运行 pod install
命令。
要求
适用于 iOS 10.3+ SDK
安装
ReviewKit 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中:
pod 'ReviewKit'
最佳实践
使用说明
定义显示提示的规则
// Request to rate or/and write a review on 3rd, 20th app launches & repeat for every 100th app launch
let appLaunchInterval = RequestInterval(first: 3, second: 20, repeatEvery: 100)
let rule1 = RequestReviewRule(ruleType: .appLaunches, requestInterval: appLaunchInterval)
// Request to rate or/and write a review on 5th and 15th time user finishes Say Hello process. Request again on every 50th time.
let sayHelloProcessInterval = RequestInterval(first: 5, second: 15, repeatEvery: 50)
let rule2 = RequestReviewRule(ruleType: .customProcess(key: "SAY_HELLO"), requestInterval: sayHelloProcessInterval)
// Request to rate or/and write a review on 5th and 10th time user finishes Wave Bye process. Request again on every 20th wave bye.
let waveByeProcessInterval = RequestInterval(first: 5, second: 10, repeatEvery: 20)
let rule3 = RequestReviewRule(ruleType: .customProcess(key: "WAVE_BYE"), requestInterval: waveByeProcessInterval)
增加事件/过程的触发次数
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Registers and increments occurrence of app launch event
ReviewManager.default.incrementOccurrence(for: .appLaunches)
return true
}
请求为App评分/评论
// Asks the user for ratings and review, if appropriate.
ReviewManager.default.requestReview(for: appLaunchRule)
许可协议
ReviewKit 采用 MIT 许可协议。更多信息请查看 LICENSE 文件。