在Parse中将设备令牌写入自定义类

时间:2015-03-08 13:11:56

标签: ios swift parse-platform devicetoken

在用户注册他们的设备之后,我正在尝试将用户设备令牌写入自定义类列以及安装类 - 是否有一种简单的方法可以执行此操作或将设备令牌作为变量拉出每次a用户将数据提交给Parse?

appdelegate.swift中的代码

        func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    let installation = PFInstallation.currentInstallation()
    installation.addUniqueObject("Status", forKey: "channels")
    installation.setDeviceTokenFromData(deviceToken)
    installation.saveInBackground()
}

submitcontroller.swift中的代码

            var query :PFQuery = PFQuery(className: "submission")
    var object_submission = PFObject(className: "submission")
    object_submission.setObject(appdelegate.deviceToken, forKey: "deviceToken")

0 个答案:

没有答案