PoliteReview 1.2.1

PoliteReview 1.2.1

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2017年9月
SwiftSwift 版本3.1
SPM支持 SPM

年由 kchau 维护。



一种优雅的方式来请求 iOS 的评价和评论

特性

Polite Review 是从用户处请求评价和评论的一种优雅的方法。

  • 自动抓取您的本地化应用名称,默认使用 "此应用"。

  • 支持本地化(目前包括英语、简体中文、繁体中文)。

  • 对于 10.3 及以上版本,使用 StoreKit 请求评价,符合商店指导方针。

  • 对于低于 10.3 的版本,将回退到简单的提醒,该提醒将打开应用商店的评论页面。

即将推出

  • Swift 4
  • 测试

入门

使用 Carthage(即将推出)和 CocoaPods 是开始使用 PoliteReview 的最佳方法。

使用方法

将 PoliteReview 添加到 AppDelegate

import PoliteReview

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    PoliteReview.main.setup(itunesID: <your itunes id>, contactURL: <a link to a website contact page>, contactEmail: <your contact email>, triggerCount: <a launch count>)
    return true
}
  • 您的 iTunes 应用 ID 是在 iTunes Connect 中找到的一串数字。
  • 触发计数是应用程序在显示任何提醒之前最小的启动次数。如果没有指定值,则默认为 5。

在任何 ViewController 中,您可以通过调用 requestPoliteReview() 来请求一个评价。PoliteReview 将确定是否显示提醒。

示例

class ViewController: UIViewController {
...

    func methodCalledByUser() {
    ...
    requestPoliteReview()
    }
}    

通知

PoliteReview 支持通知。您可以使用这些触发分析事件或进行其他操作。它们将使用 userInfo 来报告操作的结果,并用 yes 表示 true,用 no 表示 false

Notification.Name 已扩展,您可能观察到以下内容。

  • .politeReviewLoveAlert 带有 userInfo: PoliteReviewNotification.loveAlert
  • .politeReviewLegacyRequest 带有 userInfo: PoliteReviewNotification.legacyReview
  • .politeReviewContactAction 带有 userInfo: PoliteReviewNotification.contactAction

.politeReviewLegacyRequest 只有在用户低于 10.3 时才会发布。

用法

// Register your observer
NotificationCenter.default.addObserver(self, selector: #selector(observedMethod(_:)), name: .politeReviewLoveAlert, object: nil)

// Method to handle your observer
@objc private func observedMethod(_ notification: Notification) {
    if let action = notification.userInfo?[PoliteReviewNotification.loveAlert] as? Bool {
        if action == true {
            // Do stuff when user likes your app - they may have left a rating
        } else {
            // Do stuff when user did not like your app
        }
}