I have a UISwitch in my app which I want to register and unregister push notifications. I am currently using parse and I want the app to update to devicetoken in the usertable on the server as well. I'm using this code but it crashes when I flip the switch. "Can't use nil for keys or values on PFObject."
So how would I deal with dropping the value from the current installation and usertable if I can't set to nil.
UIApplication.sharedApplication().unregisterForRemoteNotifications()
switchValue.setOn(false, animated: true)
installation.deviceToken = nil
user["devicetoken"] = nil
user.saveInBackground()
You should use removeObjectForKeyon PFObject. that way when you get back same data from parse, you will get nil, not an empty string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With