How to delete a user default value in NSUserDefaults?(如何删除 NSUserDefaults 中的用户默认值?)
问题描述
即,我的应用在开始时设置了一些标准默认值.然后这些值可能会被用户覆盖.当用户把事情搞砸时,我想将这些设置设置回我的应用程序默认值.据我了解,应用程序默认值与用户默认值不同,用户默认值只是覆盖这些应用程序默认值.但我还没有看到删除用户默认值的方法.有什么想法吗?
I.e., my app sets some standard default values at the beginning. Then those values may get overridden by the user. And when the user messes things up, I want to set those settings back to my app default values. As I understand it, the app defaults are a different dictionary than the user defaults, and the user defaults just override those app defaults. But I haven't seen methods for deleting the user defaults. Any idea?
推荐答案
试试removeObjectForKey
-- 这应该使您能够删除首选项.
Try removeObjectForKey
-- that should give you the ability to remove a preference.
这篇关于如何删除 NSUserDefaults 中的用户默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!