ios - 留下评论后用元素奖励用户

标签 ios swift swift4

在我的应用程序中,我有一个“给我们评分”按钮,我想让用户在对我的游戏发表评论时获得丰厚的奖励。

但我不希望用户能够按下按钮,然后立即返回应用程序并在不留下评论的情况下获得奖励。

我该如何设置?

这是我用来将用户重定向到应用程序评论部分的代码:

let appID = "1292341923"
let reviewString = "https://itunes.apple.com/us/app/id\(appID)?ls=1&mt=8&action=write-review"

func open(url: URL) {
    if #available(iOS 10, *) {
         UIApplication.shared.open(url, options: [:], completionHandler: { (success) in
             print("Open \(url): \(success)")
         })
     } else if UIApplication.shared.openURL(url) {
            print("Open \(url): succeeded")
     }
}

if let checkURL = URL(string: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=\(appID)&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8") {
    open(url: checkURL)
} else {
    print("invalid url")
}

最佳答案

不可能检测评论发送。由于应用程序沙箱,如果未记录用户在其他应用程序中的行为,您无法直接检测该用户的行为,尤其是在系统应用程序中。

实际上,您可以做的最接近的事情是将用户重定向到 App Store 的评论页面。

关于ios - 留下评论后用元素奖励用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46665070/

相关文章:

swift - 以编程方式创建动态多个 UIButton

download - 在 URLSession Background-DownloadTask 期间重新进入 Detail-VC 后 UI 卡住

android - 在 React Native 中的现有状态转换期间(例如在 `render` 内)无法更新

ios - 使用自定义按钮类调用特定 View Controller

ios - Firebase - 按顺序获取数据列表(最后的数据在前)

ios - 上传到AWS服务器上传失败?

ios - 在 swift 4 中使用来自 cocoapods 的 Nib

ios - 将十进制转换为十六进制,添加到字节数组

arrays - fatal error : Index out of Range Swift 3. 1

ios - 从应用程序委托(delegate)访问导航 Controller