【发布时间】:2015-02-26 19:10:34
【问题描述】:
我的应用中有一个 UISwitch,我想注册和取消注册推送通知。我目前正在使用解析,我希望应用程序也更新为服务器上用户表中的 devicetoken。我正在使用此代码,但是当我拨动开关时它会崩溃。 “不能将 nil 用于 PFObject 上的键或值。”
如果我不能设置为 nil,我将如何处理从当前安装和用户表中删除值。
UIApplication.sharedApplication().unregisterForRemoteNotifications()
switchValue.setOn(false, animated: true)
installation.deviceToken = nil
user["devicetoken"] = nil
user.saveInBackground()
【问题讨论】:
标签: ios swift parse-platform null