swift - Parse.com 安装 - 设备上打开的时间

标签 swift parse-platform

在 Parse.com 数据选项卡中,有一个“安装”选项,我可以在其中查看已安装并运行我的应用程序的所有设备的信息。

如何检测设备打开我的应用程序的次数?我想计算每个设备打开我的应用程序的次数。

最佳答案

向安装类添加一个编号,以便在应用程序打开时递增/保存。这应该位于应用程序委托(delegate)的 func applicationDidBecomeActive(application: UIApplication) 中。当应用程序从后台恢复时也会调用此函数。

var installation = PFInstallation.currentInstallation()
installation.incrementKey("appOpens")
installation.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
    if (success) {
        println("appOpens incremented")
    } else {
        println("save error: \(error) \(error!.userInfo!)")
    }
}

关于swift - Parse.com 安装 - 设备上打开的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32555410/

相关文章:

SwiftUI - 列表中的两个按钮

ios - 空行和节标题的 Swift TableView 背景

android - Android 版 Parse.com : GetCallback implementation of "done" method

parse-platform - 使用解析和 Android 客户端的谷歌云消息推送不起作用

swift - 变量未保存在闭包之外

ios - 完成处理程序 - 解析 + Swift

ios - 为什么 UIImageview 不是完美的圆?

ios - 如何将 UIWebView 链接到网站

xcode - Swift:如何将 UIImageView 的缩放区域显示到另一个 UIImageView 中

android - 如何在 Android 中解析来自 Parse.com 的数组